Plot Power Spectral Density (psd)
plot_psd(x); plot_psd(x,fs[,opt]); plot_psd(x,fs[,opt],fmin,fmax); plot_psd(x,fs[,opt],fmin,fmax,nwin);
Input signal (real or complex)
Input signal sampling rate, in Hz
String option to be passed to the plot function (like 'r' for a red color)
Minimum frequency to display (default is for complex signals, or 0 for real signals)
Maximum frequency to display (default is )
Plot power versus frequency. If the input signal is real, then only the positive frequencies are plotted. Otherwise (complex signal), both positive and negative frequencies are displayed.
Note that this function compute the PSD in a very simple way: it just apply a Hann window before doing the DFT. So, it is just a convenience function to have a quick view at the spectrum of a signal. For more advanced PSD, see the cspect, pspect, ... native functions of SCILAB.
// Sampling rate = 48 kHz, real signal @ 12 kHz fs = 48e3; f = 12e3; t = (0:1/fs:1)'; x = sin(2*%pi*f*t); clf(); plot_psd(x,fs); | ![]() | ![]() |
// Sampling rate = 48 kHz, complex signal @ 12 kHz fs = 48e3; f = 12e3; t = (0:1/fs:1)'; x = exp(2*%pi*%i*f*t); clf(); plot_psd(x,fs); | ![]() | ![]() |
// Plot the PSD of a test BPSK signal (sampled at 1 MHz) // and zoom between 100 KHz and 300 KHz x = sct_test_signal1(); plot_psd(x,fs=1e6,fmin=100e3,fmax=300e3); | ![]() | ![]() |