view m-toolbox/test/test_ao_pwelch.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

% Test ao/pwelch functionality.
%
% M Hewitson 08-05-08
%
% $Id: test_ao_pwelch.m,v 1.7 2009/02/02 15:20:38 hewitson Exp $
%
function test_ao_pwelch()
  
  nsecs = 10;
  fs    = 1000;
  
  pl = plist(...
    'nsecs', nsecs, ...
    'fs', fs, 'tsfcn', ...
    '(t.^2 - (t.^3)/10) + sin(2*pi*7*t) + randn(size(t))');
  
  a1 = ao(pl);
  a2 = ao(pl);
  
  % Make PSDs
  Nfft = 2*fs;
  win = specwin('Hanning', Nfft);
  pl  = plist('Nfft', '2*fs', 'win', win, 'order', 2, 'Scale', 'ASD');
  a3 = psd(a1,pl);
  
  [pxx,f] = pwelch(a1.data.y, win.win, Nfft/2, Nfft, a1.data.fs);
  a4 = ao(fsdata(f.', pxx.'));
  
  % Plot
  iplot(a3, a4, plist('LineStyles', {'', '--'}))
  iplot(a3./a4)
  
end
% END