How can I implement FFT (y-axis:Power, x-axis:Frequency) with 4 cases: Lowpass/Highpass/Band/Notch
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
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
채택된 답변
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
Dear Mr. Carlos,
Thank you so much. Currently, I am new with this field, and I need only use matlab functions (not design tool) for FFT-Lowpass/Highpass/... with output data is two-dimension array: y-axis(Power):x-axis(Hz). I have also refered many links on Matlab. It's hard for me to find matlab functions that is related to FFT-Lowpass/Highpass/Band/Notch with y-axis(Power):x-axis(Hz).
If you know those matlab functions. Need your help. Thank you so much.
Best Regards,
Another simple approach to filter with fft is this one
f=20; % frequency
A=4;% amplitude
Fs=f*100;%sampling frequency
Ts=1/Fs;%sampling period
t=0:Ts:10/f;%time vector
x=A*sin(2*pi*f*t);%20 Hz sine wave
x2=A*sin(2*pi*(f+50)*t);70 Hz sine wave
x=x+x2;%sum of the 2 signals
plot(x)
F=fft(x);%fft of the 2 signals
figure
N=Fs/length(F);
baxis=(1:N:N*(length(x)/2-1));
plot(baxis,real(F(1:length(F)/2)))
A1=zeros(length(F),1); % generate a zeros vector of the same length as the FFT
A1(10:11)=F(10:11); %here comes the filtering with the fft,we just take the spectrum of the 50Hz signal
xr=ifft(A1); %we recover the 50Hz signal
plot(real(xr)),grid on
hope it helps
Dear Mr. Carlos,
Thanks for your support early.
I will refer your source code and link above. And I will need your help more when I meet problems about that. Thank you so much.
Best Regards,
Dear Mr. Carlos,
Currently, I have refered your link and your source code above. I can not found matlab functions that support FFT with 4 cases: Low pass, High pass, Band and Notch. And output data including two parts: + For y-axis: Power (microV or V); + For x-axis: Frequency (Hz).
Please give me other functions for support my problems above. Thank you so much.
Best Regards, (my skype: thuanpq78)
I have given you links that where you can find functions to design filters. Depending on the input parameters you can design a different type of filter. As far as you are concerned the FFT is just an algorithm to obtain your frequency response.
Your steps should be the following
1) Design your filter (depending on the type of filters low, high... you should change the imput parameters)
2)Obtain the frequency response of your filter
3)Multiply the your signals' frequency response times the filter freqeuncy response(you should do this 4 times once for ecery type of filter).
Do you mean power (Watts, W) or voltage (V) when talking about the Y-axis?
Dear Mr. Carlos,
Power is microVolt in the Y-axis. Input data is one-dimension array of values in range [-250;250] (microVolt).
Thanks for your support.
Ok. Then we are talking about voltage
Dear Mr. Carlos,
Your steps is good for me. And I need functions used for each step. It will be more clearly for me.
Thank you so much.
There are different methods to design filters (Butterworth, Chebyshev...) Look at the examples in these pages
Dear Mr. Carlos,
There are two domains to use: Digital Domain and Analog Domain. Currently, I use eeg data (in microVolt). And I will choose Digital Domain. Is this right? Thanks for your support.
Best Regards,
추가 답변 (1개)
Dear Mr. Carlos,
I have implemented FFT with 4 filters. Thanks for your support.
Best Regards, Thuan Phan
카테고리
도움말 센터 및 File Exchange에서 Analog Filters에 대해 자세히 알아보기
태그
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
