Plotting different filtering functions WITH DATA
11 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I'm trying to filter an ECG signal but I am unsure how to filter the data and then plot the filter with my own data using the parameters set. I know that fvtool and freqz can plot the magnitude and phase but I can't figure out how to plot the filter on my data (yes I've tried using plot! :) ) I've used a ton of different filtering techniques and my latest can be seen below (taken from a previous post). Can I use "plot" to plot my data with this filter and if so how? Please let me know as I am desperate!!! Thank you in advance.
Fs = 2000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [2 100]/Fn; % Filter Passband (Normalised)
Ws = Wp .* [0.5 1.2]; % Filter Stopband (Normalised)
Rp= 1;
Rs= 50;
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs);
[b,a] = cheby2(n, Rs, Ws);
[sos,g] = tf2sos(b,a);
%figure(1)
%freqz(sos, 1024, Fs)
0 个评论
采纳的回答
Star Strider
2019-6-18
‘Can I use "plot" to plot my data with this filter and if so how?’
Yes. It depends on what you want to plot.
To plot your filtered data as a function of time, and if ‘t’ is your time vector, and ‘data’ is your data vector:
filtered_data = filtfilt(sos, g, data);
figure
plot(t, filtered_data)
grid
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!