What does two sided spectrum represent in fft function of MATLAB? Can someone explain fft and its plot in MATLAB?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
close all;
clear all;
clc;
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
S = sin(2*pi*50*t) ;
plot (S)
Y=fft (S);
figure
% Y = fft(S);
P2 = abs(Y/L); % find absolute value.normalization
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/214452/image.png)
I should get fft at 50Hz. But after plotting P2 it shows above plot.
What is step by step explanation for fft in MATLAB?
1 Kommentar
Adam
am 17 Apr. 2019
You need to create your frequency vector to plot the spectrum against, rather than just indices, as is done in examples in
doc fft
Those examples just plot a single-sided spectrum for the positive frequencies, which is usually all you want unless you especially want to do things with negative frequencies. Unless you have a complex signal the negative half of the spectrum will just mirror the positive half about either 0 or the nyquist frequency. It isn't something that is useful in most cases.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Spectral Measurements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!