view m-toolbox/test/test_ao_filtSubtract.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line source

% Test script for ao/filtSubtract
%
% M Nofrarias 14-05-09
%
% $Id: test_ao_filtSubtract.m,v 1.1 2009/08/06 09:12:12 miquel Exp $
%

%% Make test AOs

% clear 

nsecs = 1000;
fs    = 10;


pl1 = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))');
a1 = ao(pl1);


pl2 = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*0.01*t)');
a2 = ao(pl2);

% linear coupling
a3 = a1 + a2
a3.setName('input')

%%  Filter Subtraction

w = specwin('Kaiser', 100, 90);
% plist lcohere
pll = plist(...
  'type','ms',...
  'Kdes', 100,...
  'win',w,...
  'Jdes', 200,...
  'Order', 1,...
  'variance','no');

% plist zDomainFit fit
plf = plist('fs',fs,...
    'AutoSearch','on',...
    'StartPoles',[],...
    'StartPolesOpt','real',...
    'maxiter',500,...
    'minorder',3,...
    'maxorder',4,...
    'FITTOL',1e-8,...
    'MSEVARTOL',1e-8,...
    'Plot','off',...
    'ForceStability','on',...
    'direct term','off',...
    'CheckProgress','off');
  
% plist split
plb = plist('times',[10 1000],...
  'filtspl',[0.1  5]);

a4 = filtSubtract(a3,a1,pll,plf,plb);


%% Plot

iplot(a1,a3)

iplot(a4)

%% Test Subtraction

b = lpsd(a3,a4)
b.iplot

%% History

plot(a4.hist)