I tried using 'FFT' function in MATLAB to transform the given function from time to frequency domain...it gave me the graph but on the x axis the time domain(values) remained the same and did not change into frequency domain as the graph revealed..

I tried using 'FFT' function in MATLAB to transform the given function from time to frequency domain...it gave me the graph but on the x axis the time domain(values) remained the same and did not change into frequency domain as the graph revealed..

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 6 月 13 日
The fft function has one output argument, it's the discrete fourier transform of your function. you have to provide the frequency vector to plot your output.

3 件のコメント

Hrushikesh
Hrushikesh 2013 年 6 月 15 日
can we use the FFT block in matlab simulink browser directly to calculate fourier transform....rather than programming in matlab and providing corresponding frequency values... if yes ...please tell me how?
Try Spectrum Analyzer from DSP System Toolbox
Hrushikesh
Hrushikesh 2013 年 6 月 18 日
THANKS

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

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 6 月 13 日
How did you do the plotting? The fft() call does not do any plotting of its own, and if you call plot() then you need to pass in the correct x values for what the data represents.

1 件のコメント

Hrushikesh
Hrushikesh 2013 年 6 月 14 日
i used the scope at the output of the fft block, which gave the plot of displacement vs time instead of disp. vs frequency...am i doin the right thing...?

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

Aalya
Aalya 2013 年 6 月 15 日
I am facing somehow a similar problem. However in my case, instead of having peak amplitude at the natural frequency, I am having it elsewhere. What could be wrong? I have obtained the time domain values from tout and simout parameters of simulink. My codes are below:
T=tout(2,1)-tout(1,1); %sample time
Fs=1/T; %sampling frequency
L=size(simout,1); %length of signal
t = (0:L-1)*T; % Time vector
y=simout(:,1);
figure(1)
plot(t,y)
title('time domain resonse of first mode')
xlabel('time (milliseconds)')
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2);
% Plot single-sided amplitude spectrum.
figure(2)
plot(f,2*abs(Y(1:NFFT/2)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
Thanks

Community Treasure Hunt

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

Start Hunting!

Translated by