Plot single-sided amplitude spectrum.
Show older comments
hello .
i tried to find a code for ploting fft,and i found this code which plot single-sided amplitude spectrum according to it's title,is it the same as fft?what is different between single side amplitude spectrum and fft? and is this code ok?
i really appreciate it if you help me.
i have a signal with 135 data point.
Fs = 50; % Sampling frequency T = 1/Fs; % Sample time L = 135; % Length of signal
NFFT = 2^(nextpow2(L)-1);
x=zeros(NFFT,1); x(1:NFFT,1) = rawdata(1:NFFT,1);
YY = fft(x,NFFT)/L; ff = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum. plot(ff,2*abs(YY(1:NFFT/2+1))) title('Single-Sided Amplitude Spectrum of tp') xlabel('Frequency (Hz)') ylabel('|Y(f)|')
2 Comments
sampath kumar kuppa
on 4 Nov 2016
you got the solution for this code or not. I'm also facing the same problem. if you got the solution means please forward to me.
Stephen Capasso
on 17 Aug 2021
This has been useful does anyone know how to adjust the plot statement for log space instead of linspace. ff= Fs/2*logspace(0,1,NFFT/2+1); What would go in the argument for a 4 cycle semi log?
Accepted Answer
More Answers (1)
Charanraj
on 9 Jul 2015
0 votes
hey, can a single sided FFT taken directly from the scope by using an absolute block before the scope ?
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!