Filter PPG signal using FIR filter instead of IIR Filter

9 views (last 30 days)
I am using following code to high pass filter PPG signal. But I want to use some alternate FIR filter in order to perform the same task. Can you please advise some alternate FIR filter with same response and small order n
t = linspace(0, numel(ppg_head), numel(ppg_head))/fs;
Fs = 960; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = 24.5/Fn; % Stopband Frequency (Normalised)
Ws = 25.0/Fn; % Passband Frequency (Normalised)
Rp = 1; % Passband Ripple (dB)
Rs = 50; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws,'high'); % Filter Design, Sepcify Bandstop
[sos,g] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(2)
freqz(sos, 2^16, Fs) % Filter Bode Plot
ppg_head_data = filtfilt(sos, g, ppg_head); % Filter Signal

Answers (1)

Star Strider
Star Strider on 8 Apr 2021
Try this:
Fs = 960;
fcomb = [24.5 25];
mags = [1 0];
dev = [0.8 0.1];
[n,Wn,beta,ftype] = kaiserord(fcomb,mags,dev,Fs);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
figure
freqz(hh, 1, 2^20, Fs)
set(subplot(2,1,1), 'XLim',[0 50]) % Optional
set(subplot(2,1,2), 'XLim',[0 50]) % Optional
Then use filtfilt to do the actual filtering.
  3 Comments
Star Strider
Star Strider on 16 Apr 2021
My pleasure!
I believe fdatool is now filterDesigner in the DSP Toolbox (that I do not have so I cannot help you with it).
Realising a FIR filter in hardware is not something I have ever done (my experience is limited to IIR filter realisation). I have no idea how you want to do it, however there is apparently a way to do that. The approach in fdatool to fpga will likely get you started in the correct direction.
Star Strider
Star Strider on 16 Apr 2021
Alright can you help me with implementing IIR filter realisation?
Unfortunately, no. I do not have the DSP Toolbox.
Also, I have only used op-amps to realise continuous-time filters in hardware, not discrete filters.

Sign in to comment.

Categories

Find more on Digital and Analog Filters in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!