How can I implement FFT (y-axis:Power, x-axis:Frequency) with 4 cases: Lowpass/Highpass/Band/Notch
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi,
Currently I implement FFT (y-axis:Power, x-axis:Frequency) as below: (based on http://www.mathworks.com/help/matlab/math/fast-fourier-transform-fft.html)
d1=-250
d2=250
data= d1 + (d2-d1).*rand(1,256)
Fs=30
m = length(data); % Window length
n = pow2(nextpow2(m)); % Transform length
y = fft(data,n); % DFT
f = (0:n-1)*(Fs/n); % Frequency range
power = y.*conj(y)/n; % Power of the DFT
plot(f,power)
xlabel('Frequency (Hz)')
ylabel('Power')
title('{\bf Periodogram}')
Currently, I don't know how to customize source code above for Lowpass/Highpass/Band/Notch.
Please help me, thanks for your support.
Best Regards,
Thuan Phan
댓글 수: 0
채택된 답변
Carlos
2014년 4월 1일
If you want to filter a signal in the frequency domain you just need to multiply your signals' frequency response (y in your code) by the frequency response of your filter.
In order to calcute your filter coefficients and if you have the filter design toolbox this tutorial has all the information you might need http://www.mathworks.com/tagteam/55876_digfilt.pdf
You can also design your filter using the fdatool or using the signal processing toolbox (here you can find all of the filter functions in the signal processing toolbox http://www.mathworks.es/es/help/signal/analog-filters.html)
댓글 수: 10
Carlos
2014년 4월 1일
There are different methods to design filters (Butterworth, Chebyshev...) Look at the examples in these pages
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Analog Filters에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!