I have implemented a pulse oximeter on FPGA and I am collecting the data at sampling rate = 115200. So when I plot the data in Matlab I get the following waveform:
I would like to set up a simple low pass filter to filter out the noise.So the filtered data looks something like this:
How do I design this filter? How do I determine the cutoff frequency for butterworth filter ([b,a] = butter(n,Wn))?
W1=0.5/60; % lower cutoff
W2=4/60; %higher cutoff
[b,a]=butter(2,[W1,W2]); % Bandpass digital filter design
h = fvtool(b,a); % Visualize filter
low_pass_data1 = filtfilt(b,a,data); % applying filter to our data
The above mentioned algorithm works and I got it from the internet but I don't know how it works? There is no mention of the sampling rate in the above algorithm and yet it works! I don't even know if it's right.

