Reading data from a heart sensor

Hi there!

For a school project we want to use a infrared lightsensor that can measure the heart rate.
We are using Arduino Uno and Matlab to aqcuire this data.
However, we don't understand the incomng data and therefore do not know how to process it into BPM.
This is our code:

function result = plot_graph(t, a)
value = zeros(t, 1);

for i = 1:t;
value(i) = readVoltage(a, 'A2');
end

plot(value);

end

The plot gives values ranging from 3.4 to 3.5 without clear structure. Also, because the difference between the high and low peaks is so small, we are uncertain how to read the data.

Can anybody tell whether the code is correct or how to transform the acquired signal in something that makes more sense?

Thanks!

value(i) = readVoltage(a, 'A2');

Do you need 'A2', or just A2?
Or just analogRead(A2); ?

What are you using for a sensor?

We are using an ir sensor attached to the finger, I can't find the exact model we are using on the internet unfortunately.

The quotes in 'A2' are needed for Matlab to handle the input, so that should be fine.

What is the difference between analogRead and readVoltage? How do we know when to use what?