# Hello all, I have a signal defined by the below. I want to take the Matlab FFT of this signal but I got a plot that does is not the Fourier Transform. Can someone direct me on how to be able to compute the FFT of my signal? Thanks Mates!

2 visualizzazioni (ultimi 30 giorni)
Neo il 5 Lug 2015
Commentato: Neo il 6 Lug 2015
Signal defined by:
%%Time specifications:
Fs = 8000; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.25; % seconds
t = (0:dt:StopTime-dt)'; % seconds
%%Sine wave:
Fc = 60; % hertz
x = 3*sin(x) + sin(.5*x+40) + 2*sin(3*x-60);
% Plot the signal versus time:
figure;
plot(t,x);
xlabel('time (in seconds)');
title('Signal versus Time');
zoom xon;
The signal image is attached.
I did this for the FFT of the signal:
Y = fft(x);% Plot single-sided amplitude spectrum.
plot(Y)
title('Fast Fourier Transform of X graph)')
xlabel('Frequency (Hz)')
ylabel('Time (seconds)')
I figured since it was a simple function, I did not need elaborate coding but then I got the "FFT" attached.
Can someone tell me how to get the correct FFT please! Thanks.
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Neo il 6 Lug 2015
I actually typed it in as I wrote it and I got a function (signal anyway) do you know why that is?
Neo il 6 Lug 2015
I used the correction that you noted and I got a straight line instead of a signal.

Accedi per commentare.

### Risposta accettata

Image Analyst il 5 Lug 2015
Your stop time is so short that your signal is essentially a constant over that period. So the FFT is a just big DC spike as expected, which corresponds to a big "rect" function rather than the sum of 3 sine waves of different periods.
Set a stop time around 12*pi so you can get more of a varying waveform in there, especially more complete cycles instead of just a microscopic sample out of the waveform. That small sample is essentially a constant.
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Neo il 6 Lug 2015
So would this be my new code?
%% Time specifications: Fs = 8000; % samples per second dt = 1/Fs; % seconds per sample StopTime = 12*pi; % seconds t = (0:dt:StopTime-dt)'; % seconds %% Sine wave: Fc = 60; % hertz x = 3*sin(t) + sin(.5*t+40) + 2*sin(3*t-60); % Plot the signal versus time: figure; plot(t,x); xlabel('time (in seconds)'); title('Signal versus Time'); zoom xon;Y = fft(x);% Plot single-sided amplitude spectrum. plot(Y) title('Fast Fourier Transform of X graph)') xlabel('Frequency (Hz)') ylabel('Time (seconds)')
Neo il 6 Lug 2015
My new FFT which still doesn't look right.

Accedi per commentare.

### Categorie

Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by