view m-toolbox/test/test_ao_pwelch.m @ 7:1e91f84a4be8 database-connection-manager

Make ltpda_up.retrieve work with java.sql.Connection objects
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +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