Mercurial > hg > ltpda
comparison m-toolbox/test/test_ao_sDomainFit_1.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % Test script for sDomainFit | |
2 % | |
3 % L. Ferraioli 02-12-08 | |
4 % | |
5 % $Id: test_ao_sDomainFit_1.m,v 1.5 2009/08/27 11:39:23 luigi Exp $ | |
6 % | |
7 %% Building a frequency response | |
8 | |
9 % Create a frequency-series AO | |
10 % pl_data = plist('fsfcn', '0.01./(0.01+f)', 'f1', 1e-6, 'f2', 5, 'nf', 1000); | |
11 pl_data = plist('fsfcn', '(1e-3./(f).^2 + 1e3./(0.001+f) + 1e5.*f.^2).*1e-10', 'f1', 1e-6, 'f2', 5, 'nf', 1000); | |
12 a = ao(pl_data); | |
13 | |
14 iplot(a) | |
15 | |
16 %% Fitting 1 | |
17 % Check if Mean Square Error is lower than FITTOL and its relative | |
18 % variation is lower than MSEVARTOL | |
19 | |
20 % Fitting parameter list | |
21 pl_fit = plist('AutoSearch','on',... | |
22 'StartPoles',[],... | |
23 'StartPolesOpt','clog',... | |
24 'maxiter',40,... | |
25 'minorder',15,... | |
26 'maxorder',20,... | |
27 'weights',[],... | |
28 'weightparam','abs',... | |
29 'CONDTYPE','MSE',... | |
30 'FITTOL',1e-3,... | |
31 'MSEVARTOL',1e-2,... | |
32 'Plot','on',... | |
33 'ForceStability','off',... | |
34 'direct term','off',... | |
35 'CheckProgress','off'); | |
36 | |
37 % Do fit | |
38 mod = sDomainFit(a, pl_fit); | |
39 | |
40 %% Fitting 2 | |
41 % Check if Rresiduals log difference is larger than FITTOL and MSE relative | |
42 % variation is lower than MSEVARTOL | |
43 | |
44 % Fitting parameter list | |
45 pl_fit = plist('AutoSearch','on',... | |
46 'StartPoles',[],... | |
47 'StartPolesOpt','clog',... | |
48 'maxiter',40,... | |
49 'minorder',15,... | |
50 'maxorder',20,... | |
51 'weights',[],... | |
52 'weightparam','abs',... | |
53 'CONDTYPE','RLD',... | |
54 'FITTOL',1,... | |
55 'MSEVARTOL',1e-2,... | |
56 'Plot','off',... | |
57 'ForceStability','off',... | |
58 'direct term','off',... | |
59 'CheckProgress','off'); | |
60 | |
61 % Do fit | |
62 mod = sDomainFit(a, pl_fit); | |
63 | |
64 %% Fitting 3 | |
65 % Check if Rresiduals spectral flatness is larger than FITTOL and MSE relative | |
66 % variation is lower than MSEVARTOL | |
67 | |
68 % Fitting parameter list | |
69 pl_fit = plist('AutoSearch','on',... | |
70 'StartPoles',[],... | |
71 'StartPolesOpt','clog',... | |
72 'maxiter',40,... | |
73 'minorder',15,... | |
74 'maxorder',20,... | |
75 'weights',[],... | |
76 'weightparam','abs',... | |
77 'CONDTYPE','RSF',... | |
78 'FITTOL',0.03,... | |
79 'MSEVARTOL',1e-2,... | |
80 'Plot','off',... | |
81 'ForceStability','off',... | |
82 'direct term','off',... | |
83 'CheckProgress','off'); | |
84 | |
85 % Do fit | |
86 mod = sDomainFit(a, pl_fit); | |
87 | |
88 %% Comparison | |
89 | |
90 resp = mod.objs.procinfo.find('FIT_RESP'); | |
91 resids = mod.objs.procinfo.find('FIT_RESIDUALS'); | |
92 mse = mod.objs.procinfo.find('FIT_MSE'); | |
93 iplot(a,resp,abs(resids)) | |
94 iplot(mse,plist('Yscales','log')) | |
95 | |
96 %% Help test | |
97 | |
98 pl_data = plist('fsfcn', '(1e-3./(f).^2 + 1e3./(0.001+f) + 1e5.*f.^2).*1e-10', 'f1', 1e-6, 'f2', 5, 'nf', 1000); | |
99 a = ao(pl_data); | |
100 a.setName; | |
101 | |
102 % Fitting parameter list | |
103 pl_fit = plist(... | |
104 'AutoSearch','on',... | |
105 'StartPolesOpt','clog',... | |
106 'maxiter',50,... | |
107 'minorder',7,... | |
108 'maxorder',15,... | |
109 'weightparam','abs',... | |
110 'CONDTYPE','MSE',... | |
111 'FITTOL',1e-3,... | |
112 'MSEVARTOL',1e-2,... | |
113 'Plot','on',... | |
114 'ForceStability','off'); | |
115 | |
116 % Do fit | |
117 mod = sDomainFit(a, pl_fit); | |
118 | |
119 | |
120 | |
121 |