1st element of the 'Amplitude' of a fft function

35 ビュー (過去 30 日間)
NIMA FARHANG
NIMA FARHANG 2019 年 4 月 2 日
コメント済み: NIMA FARHANG 2019 年 4 月 3 日
Hello,
I want to apply an fft function on my vector (1 X 4000). Yet the 1st element of my amplitude array is sort of an outlier in respect to the other elements. (Which is the average of the amplitudes and it totally makes sense, since the fft code produces that---> and the power will be zero for k=1.)
So my question is how I can detour this or find a way to prevent such a thing without changing the first element manually. Besides I do not want to change the value of other elements. All I want is to change the X1 to zero or take it out from outlier zone.
Last but not least, here is my code:
Fs = 543; % Camera frequency which is added manually
X = st1(1,:); % st1(1,:) is a vector (1 by 4000) with elements in a range of min:305 and max:328
L = length(X); % L=4000
T_inc = 1/Fs; % Time increment for fft plot
signal_FFT = fft(X,L)/L;
amplitude = 2*abs(signal_FFT(1:ceil(L/2)));
frequency = Fs/2*linspace(0,1,ceil(L/2));
Here is the 2 plots (frequency,amplitude,'red') with the same values apart from their first element. The upper one is the actual array and the below one is the one with the 1st element manually changed into zero:
I would be quite appreciated if being suggested a more proper fft code.
Thanks in advance for your concern.
-Nima :)

採用された回答

David Goodmanson
David Goodmanson 2019 年 4 月 3 日
Hi NIma,
As you point out, signal_FFT(1) is the sum of all the X values (or the mean if you divide by the number of points in X). It is the DC component of X and it can be quite large compared to the other fft components if X has a DC offset. If you are not interested in the DC component, the standard way to get rid of it is by subtracting the mean off of every element of X before doing the fft. The line
X = X-mean(X);
followed by the fft accomplishes this.
  1 件のコメント
NIMA FARHANG
NIMA FARHANG 2019 年 4 月 3 日
Thanks a lot! :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

製品


リリース

R2012b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by