My snipet code have 3 harmonics, second's amplitude is maximum, but abs(fft(X)) returns first as maximum. I use MATLAB R2022a.
3 ビュー (過去 30 日間)
古いコメントを表示
Georges Theodosiou
2022 年 9 月 14 日
コメント済み: Georges Theodosiou
2022 年 9 月 28 日
In Xn first harmonic's amplitude is 170, second's 220, and third's 150. But abs(fft(Xn) returns maximum first's. Thanks in advance. It is executing in R2022a version.
SampFreq = 16000;
Segm = 1:2048;
Pitch = 45;
FirstHarmAngles = Pitch*2*pi/SampFreq*Segm+1.9*pi;
SinFirstHarmAngles = sin(FirstHarmAngles);
SecondHarmAngles = Pitch*2*2*pi/SampFreq*Segm+2.9*pi;
SinSecondHarmAngles = sin(SecondHarmAngles);
ThirdHarmAngles = Pitch*3*2*pi/SampFreq*Segm+0.3*pi;
SinThirdHarmAngles = sin(ThirdHarmAngles);
Xn = 170*SinFirstHarmAngles+220*SinSecondHarmAngles+150*...
SinThirdHarmAngles;
ABS = abs(fft(Xn))
plot(ABS(1:50))
0 件のコメント
採用された回答
Jeffrey Clark
2022 年 9 月 14 日
@Georges Theodosiou, you don't have enough samples to easily interpret the abs(fft), if you change Segm = 1:2048 to use 16384 you get
Your plot from 2048 samples shows that the second peak contains the energy over a wider frequency range. Instead of increasing the number of samples this can be captured by increasing the fft n-point DFT by adding 16384 as the DFT size e.g., ABS = (abs(fft(Xn,16384))) which results in
Please see Fast Fourier transform - MATLAB fft (mathworks.com) and its examples for more information.
5 件のコメント
Jeffrey Clark
2022 年 9 月 21 日
編集済み: Jeffrey Clark
2022 年 9 月 21 日
@Georges Theodosiou, I don't have a dsp, my intel cpu for 16384 points takes 2.83e-04 seconds using MATLAB's fft.
If the fft time for you is too long there is a way to estimate the actual peak from your 2048 fft, which only works if you know that the frequency of the signals being measured are stable and not chirped (as is the case for your test data). In essance you compute the area under the fft curve where the phase adjacent to the peaks' phase are related using unwrap(angle(fft)).
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spectral Measurements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!