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!
Best Answer