butterworth residuals vs cutoff frequency
조회 수: 8 (최근 30일)
이전 댓글 표시
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
Jan
2012년 11월 26일
A lowpass-filter has a scalar wn frequency. For a [1 x 2] frequency a bandpass or bandstop filter is created.
채택된 답변
Wayne King
2012년 11월 26일
편집: Wayne King
2012년 11월 26일
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
Wayne King
2012년 11월 26일
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!