Bandpass and highpass filter
1 view (last 30 days)
Show older comments
Hi I have this problem. I have this vecktor z that was given to me. I fourier transform it and get Z.
----------------------------------------------
[Z,nu]=tdftfast(z);
plot(nu, abs(Z));
----------------------------------------------
I now want to filer out all 3 peaks. For the first one I use this code:
----------------------------------------------
[b,a] = butter(10,0.1);
freqz(b,a);
dataOut = filter(b,a,z);
[Z1,nu1]=tdftfast(dataOut);
plot(nu, abs(Z1));
x=ifft(Z1);
----------------------------------------------
But for the next two peaks i get some problems. I use this code for the second peak:
----------------------------------------------
[b,a] = butter(10,[0.2 0.3],'bandpass');
freqz(b,a);
dataOut = filter(b,a,z);
[Z2,nu2]=tdftfast(dataOut);
plot(nu, abs(Z2))
z2=ifft(Z2);
----------------------------------------------
It is the same thing with peak number 3. What is it that I do wrong? Don't worry about a, b, dataOut and so on since i do not run the both codes at the same time. How do I bandpass peak nr 2 and highpass peak nr 3?
I also wonder how i find the carrier frequency?
Thanks!
5 Comments
Star Strider
on 2 Feb 2015
If you are certain that those are the actual frequencies (in Hz), you can then find their indices in the nu-vector and calculate the sampling frequency, and from it the Nyquist frequency. Again, see the documentation for details.
I have no idea what function you are using to calculate your fft, but it might describe in its documentation how it determines the ‘nu’ values and what they mean. You might be able to get the relevant information from it, if it assumes (or infers) a sampling frequency from your ‘z’ data.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!