Uncertainty using FFT function.
7 次查看(过去 30 天)
显示 更早的评论
Hello all,
I am trying to get the spectral shape of my time domain signal. For this I use FFT. However, the results I get are not as expected and I cannot understand why. My code for FFT is as follows:
NFFT=length(eta);
Fs=2;
transf_length=pow2(nextpow2(NFFT));
transforma = fft(eta,transf_length);
frequ = (0:transf_length-1)*(Fs/transf_length)*2*pi; % to make in radians/s
power = transforma.*conj(transforma)/transf_length;
Everything seems to be fine, but the magnitude of the spectrum when compared to the expected spectrum is not the same (approximately 30 times larger). The first figure shows the FFT vs. the expected spectrum. The second figure shows the FFT power/30 vs. the expected spectrum.
Can someone explain if there is something wrong with my code, or I am just misunderstanding something?
Thanks!
7 个评论
Harry
2014-11-4
I think you need to strip this problem down to what you are having trouble with. Asking people to install an obscure library to run your code will possibly mean you get less help. If your problem is with the FFT, then you should be able to describe the problem with just a few lines of code.
Maybe plot the FFT of a simple signal, explain why that is correct... then plot the FFT of your signal and describe how it is not as expected.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!