Butter filter high pass and low pass
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Emma Pearce
il 29 Gen 2018
Risposto: Star Strider
il 29 Gen 2018
Hi,
when using the butter filter i can see that for the low pass if i set my cut off frequency to 100hz then anything above this is removed, as shown by the first image.
If i then use the 'high' filter, rather than allowing evrything above 100hz it allows everything above 50hz. I've not changed anything in the code other that 'low' to 'high. Image 2 shows this.
my code is,
sampling_frequency = 1600;
cutoff_f = 100;
[b,a] = butter(9,cutoff_f/(sampling_frequency/2),'low'); %i change this to 'high'
freqz(b,a)
i plot them the same way using:
dataIn = comparison_trace;
dataOut = filter(b,a,dataIn);
NFFT = 2^nextpow2(length(dataOut));
y = fft(dataOut, NFFT);
f = sampling_frequency*(0:(NFFT/2))/NFFT;
AMP = abs(y/NFFT);
PHA = angle(y);
NFFT2 = 2^nextpow2(length(comparison_trace));
y2 = fft(comparison_trace, NFFT2);
f2 = sampling_frequency*(0:(NFFT2/2))/NFFT2;
AMP2 = abs(y2/NFFT2);
PHA2 = angle(y2);
figure; subplot(2,1,2); plot(f,AMP(1:NFFT/2+1));
title('amp spec of data out')
xlabel('frequ (Hz)')
ylabel('amp')
subplot(2,1,1); plot(f2,AMP2(1:NFFT2/2+1));
title('amp spec of raw data')
xlabel('frequ (Hz)')
ylabel('amp')
Thanks!
0 Commenti
Risposta accettata
Star Strider
il 29 Gen 2018
I believe you are seeing the ‘rolloff’ or transition-region characteristics of a Butterworth filter. Note that you did not specify the stopband, only the passband. Start with the buttord function, define the stopband as well as the passband, and you will likely see a filter response closer to what you expect. (Also consider using a Chebyshev Type II design.)
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!