butterworth residuals vs cutoff frequency
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i need to apply a butterworth filter. to prove my cutoff frequency i need to do a plot ''residuals vs cutoff frequency'' like in the 2nd sqare of the picture. . residuals come from http://oi47.tinypic.com/21eokqr.jpg
so i want to apply a
-butterworth filter
-lowpass
- order n=2
- cutoff frequency wn= [0,20] hz
so my doubt is if there ia a way to find the residuals by matlab. and then plot them against cutoff frequency.
any help is huge appreciated. thank you so much
1 Commento
Jan
il 26 Nov 2012
A lowpass-filter has a scalar wn frequency. For a [1 x 2] frequency a bandpass or bandstop filter is created.
Risposta accettata
Wayne King
il 26 Nov 2012
Modificato: Wayne King
il 26 Nov 2012
You can certainly subtract the filtered waveform from the original and plot the spectrum of that difference signal. For that you should use filtfilt() to compensate for the delay.
You do not tell us your sampling frequency, so I'll just assume 1000 for this example.
x=ecg(500)'+0.25*randn(500,1); %noisy waveform
[B,A] = butter(2,20/(1000/2));
xprime = filtfilt(B,A,x);
resid = x-xprime;
Your slide seems to suggest forming the following test statistic for various values of the cutoff frequency and examining R.
wc = [10:30]./(1000/2);
for nn = 1:length(wc)
[B,A] = butter(2,wc(nn));
xprime = filtfilt(B,A,x);
resid = x-xprime;
R(nn) = sqrt(1/length(x)*(sum(abs(x-xprime).^2)));
end
4 Commenti
Wayne King
il 26 Nov 2012
For one thing, if your sampling frequency is 40 Hz, then the cutoff frequency of 0.2 is only 4 Hz. Do you really want to limit yourself to such a low frequency here. And why start at 0? You have to keep in mind that butter() accepts normalized frequencies.
Personally, I pick the cutoff frequency based on what I know about the data and what part of the spectrum I want to focus on.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!