Can't plot Fourier Transform
Afficher commentaires plus anciens
Hi, I'm trying to plot the Fourier Transform of a function which is the absolute value of x from -2 to 2, here is the code:
x=-2:0.000001:2;
f_x= abs(x);
FT = fft(f_x);
f = (0:length(FT)-1)*1000/length(FT);
figure (1)
subplot(211)
plot(x,f_x), title ('f_x');
subplot(212)
plot(f,abs(FT)), ylim([0,100]), title ('Fourier f_x');
Any suggestions?
1 commentaire
dpb
le 5 Sep 2018
Try
N=length(x);
plot(f(1:fix(N/2)+1),abs(FT(1:fix(N/2)+1))/N);
hAx.YScale='log';
Read
doc fft
example that illustrates normalizing 2-sided FFT to get one-sided PSD.
Réponses (0)
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!