%% Pseudospectrum of Real Signal
% Generate a real signal that consists of the sum of two sinusoids embedded in white Gaussian noise of unit variance. The signal is sampled at 100 Hz for 1 second. The sinusoids have frequencies of 25 Hz and 35 Hz. The lower-frequency sinusoid has twice the amplitude of the other.

fs = 100;
t = 0:1/fs:1-1/fs;

s = 2*sin(2*pi*25*t)+sin(2*pi*35*t)+randn(1,100);

%
% Use the eigenvector method to compute the pseudospectrum of the signal between 0 and the Nyquist frequency. Specify a signal subspace dimension of 2 and a DFT length of 512.

peig(s,2,512,fs,'half')

%
% It is not possible to resolve the two sinusoids because the signal is real. Repeat the computation using a signal subspace of dimension 4.

peig(s,4,512,fs,'half')

% Copyright 2012 The MathWorks, Inc.