how can i get my code to produce FFT graph.
1 次查看(过去 30 天)
显示 更早的评论
This is my code below but doesnt work
L = length(signal);
Y = fft(signal);
Y1 = abs(Y);
% onlys show one sided FFT so multiply by 2, divide by Fs to scale.
Py = (2*Y1(1:L/2) / Fs);
% create frequency vector to plot against
freq = Fs/L*(0:L/2-1);
% plot the figure
figure
plot(freq,Py);
title('Amplitude Spectral Density');
xlabel('Frequency Hz');
ylabel('Amplitude');
grid on;
end
1 个评论
dpb
2019-7-29
Please edit code to remove superfluous linefeeds and then select and use the "Code" button to format it...
回答(1 个)
Vimal Rathod
2019-8-1
The code which you have given works perfectly fine, I suspect that you are not passing an appropriate signal to the fft function.
For more information refer to the link:
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!