line source
% Test script for sDomainFit in two dimensional case
%
% L. Ferraioli 02-12-08
%
% $Id: test_ao_sDomainFit_2.m,v 1.4 2009/08/06 21:55:34 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', 1000);
a1 = ao(pl_data1);
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', 1000);
a2 = ao(pl_data2);
iplot(a1,a2)
a = [a1,a2];
%% Fitting
% Fitting parameter list
pl_fit = plist('AutoSearch','on',...
'StartPoles',[],...
'StartPolesOpt','clog',...
'maxiter',35,...
'minorder',10,...
'maxorder',25,...
'weights',[],...
'weightparam','abs',...
'CONDTYPE','MSE',...
'FITTOL',1e-3,...
'MSEVARTOL',1e-2,...
'Plot','off',...
'ForceStability','off',...
'direct term','off',...
'CheckProgress','off');
% Do fit
mod = sDomainFit(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))
iplot(mse,plist('Yscales',{'All','log'}))