View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
PSD (Power Spectral Density), and Amplitude Spectrum with adjusted FFT

4.3 | 3 ratings Rate this file 35 Downloads (last 30 days) File Size: 63.8 KB File ID: #40002 Version: 1.3
image thumbnail

PSD (Power Spectral Density), and Amplitude Spectrum with adjusted FFT


Youssef Khmou (view profile)


25 Jan 2013 (Updated )

FFT computes PSD and one sided amplitude spectrum Y[f] of 1d signal

| Watch this File

File Information

Function [fy]=FFT(y,Fs)

  1)computes the Power spectral density and Amplitude spectrum (P(f),F(f))
  of 1d signal y(t) with sample rate Fs (Nyquist rate) which is known% apriori. The results are plotted in 3 figures which correspond to simple
  PSD,logarithmic PSD (dB) and Amplitude Specturm respectively.
  Ampitude(f) = \/ PSD(f)
  2)The usefulness of this function is the adjustment of the frequency axis.

  3)The fast Fourier transform is computed with Matlab built-in function
  fft, but for signals whose lengths <1000 points, one can use the nested
  function y=Fast_Fourier_Transform(X,N) .

  Demo :

  f=[40 75];
  Amp=[4.5 9.22];
  N=(sigma/sqrt(2))* (randn(size(t))+j*randn(size(t)));
  figure, plot(t,y),xlabel('time (s)'),ylabel('Voltage (v)'),
  title(strcat('Signal corrupted with AWGN, \sigma=',num2str(sigma))),

in the M-file Demo_FFT:
1st Part : we compute the spectrum of sinusoidal signal Y(t) with frequency Fc
2nd Part : FFT[Y²(t)]

The demo is adjusted with sample rate Fs>=4*Fc.

Required Products Simulink
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
22 Nov 2016 nipawan pakoktom

13 Jul 2014 Hristo Zhivomirov

Youssef, if you want to obtain the power spectral density PSD (W/Hz) you should divide the power spectrum Power to equivalent noise bandwidth ENBW of the window.

S1 = sum(win);
S2 = sum(win.^2);
ENBW = Fs*S2/(S1^2);
PSD = Power/ENBW;

In your case there is no window (or there is rectangular one), so ENBW = Fs/L.

Comment only
23 Dec 2013 Xiaochen

I consider it a 'power spectral' plot rather than a 'power spectral density' plot. you simply make 'power=mag^2' but it's not so-called 'PSD'.

04 Sep 2013 Youssef Khmou

Youssef Khmou (view profile)

Zhivomirov Thank you for your remark, the submission has been updated .

Comment only
30 Aug 2013 Hristo Zhivomirov

Figure 2 (Power Spectral Density, logarithmic scale) is not correct. The Y scale does not represent the PSD magnitude in dB. It is just the same PSD like Figure 1, but represented on logarithmic Y scale. If you want to have a PSD in dB, use PowerdB = 10*log10(Power) and plot(f, PowerdB).

Comment only
03 Jul 2013 Antonio Blago

04 Sep 2013 1.3

errata : figure 2 is changed from semilogy(Frequency, Power) to 10*log10(Frequency, 10*log10(Power)) in Decibel .

Contact us