How to plot Butterworth filters with own data?

10 Ansichten (letzte 30 Tage)
Kathleen Nicole Rice
Kathleen Nicole Rice am 18 Jun. 2019
Kommentiert: Deepthi K am 8 Mär. 2021
Trying to use a bandpass butterworth filter on an ECG signal using the code below but whenever I use the lines:
h= filter( D,C,x) % where x= data
plot(h)
at the end of my code I just get a crazy plot which does not make sense or show my data. How could I accurately plot this filter with my data?
fp= [3 120];
fs= [2 200];
fn= 1000;
[N,fc]= buttord(fp/fn, fs/fn, 1, 60);
[D,C]= butter(N, fc);
%freqz(C,D)
h= filter(D,C,x);
plot(h) % these last 2 lines give strange results
  1 Kommentar
Deepthi K
Deepthi K am 8 Mär. 2021
How to get the values of filtered data. i.e. value of h?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 18 Jun. 2019
It would help to know the sizes of ‘x’ and ‘h’.
You should also have a time vector, so:
figure
plot(t, h)
grid
will plot ‘h’ as a function of time vector ‘t’.
  4 Kommentare
Kathleen Nicole Rice
Kathleen Nicole Rice am 19 Jun. 2019
Great, this fixed the problem. Thank you so much!
Star Strider
Star Strider am 19 Jun. 2019
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by