Mercurial > hg > ltpda
diff m-toolbox/test/test_ao_zDomainFit_2.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/test/test_ao_zDomainFit_2.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,55 @@ +% Test script for zDomainFit in two dimensional case +% +% L. Ferraioli 02-12-08 +% +% $Id: test_ao_zDomainFit_2.m,v 1.5 2009/12/02 16:50:49 luigi Exp $ +% +%% Building a frequency response + +% Create a frequency-series AO +pl_data1 = plist('fsfcn', '(1e-3./(f).^2 + 1e3./(0.001+f) + 1e5.*f.^2).*1e-10', 'f1', 1e-6, 'f2', 5, 'nf', 100); +a1 = ao(pl_data1); +a1.setName; + +pl_data2 = plist('fsfcn', '(5e-3./(2e-5+f).^2 + 5e3./(0.001+f) + 5e4.*f.^2).*1e-10', 'f1', 1e-6, 'f2', 5, 'nf', 100); +a2 = ao(pl_data2); +a2.setName; + +iplot(a1,a2) +a = [a1,a2]; + +%% Fitting + +% Fitting parameter list +pl_fit = plist('FS',10,... + 'AutoSearch','on',... + 'StartPoles',[],... + 'StartPolesOpt','clog',... + 'maxiter',60,... + 'minorder',15,... + 'maxorder',35,... + 'weights',[],... + 'weightparam','abs',... + 'CONDTYPE','MSE',... + 'FITTOL',1e-4,... % check if MSE is lower than 1e-4 + 'MSEVARTOL',1e-2,... + 'Plot','off',... + 'ForceStability','off',... + 'CheckProgress','off'); + +% Do fit +mod = zDomainFit(a, pl_fit); + +%% Comparison +resp(2,1) = ao; +resids(2,1) = ao; +mse(2,1) = ao; + +for ii = 1:numel(mod.objs) + resp(ii) = mod.objs(ii).procinfo.find('FIT_RESP'); + resids(ii) = mod.objs(ii).procinfo.find('FIT_RESIDUALS'); + mse(ii) = mod.objs(ii).procinfo.find('FIT_MSE'); +end + +iplot(a,resp,abs(resids)) +