comparison m-toolbox/test/test_matrix_linearize.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 for matrix/linearize
2 %
3 % 15-01-2010 L Ferraioli
4 % CREATION
5 %
6 %
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8 % $Id: mdc3_exp3_loop_v3.m,v 1.2 2009/09/24 09:48:12 luigi Exp $
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11
12 %% Loading data
13
14 fprintf('===== loading data... =====\n')
15
16 % laod parnames and values
17 load C:\Users\Luigi\ltp_data_analysis\MDCs\MDC3\lf_analysis\Models\parnames_10perc.mat
18 load C:\Users\Luigi\ltp_data_analysis\MDCs\MDC3\lf_analysis\Models\exp3_2_10perc_nomvalues.mat
19 load C:\Users\Luigi\ltp_data_analysis\MDCs\MDC3\lf_analysis\Models\exp3_2_10perc_truevalues.mat
20 % load C:\Users\Luigi\ltp_data_analysis\MDCs\MDC3\lf_analysis\Models\usedparams_10perc.mat
21
22
23 % set ordered used parameters
24 usedparams = {'dH','dsH','dS11','dS1D','dSD1','dSDD',...
25 'dh2','dsh2','dx1','dx2'};
26
27 [nonfitparnms,ia,ib] = setxor(parnames,usedparams);
28 nonfitnomvals = exp3_nomvalues(ia);
29 nonfittruevals = exp3_truevalues(ia);
30
31 [fitparnms,ia,ib] = setxor(parnames,nonfitparnms);
32 fitnomvals = exp3_nomvalues(ia);
33 fittruevals = exp3_truevalues(ia);
34
35 %% get non-linear response model
36 % the model is non-linear in the parameter dependence
37 fprintf('===== Get TF Model... =====\n')
38
39 H = matrix(plist('built-in','mdc3_ifo2ifo_v2'));
40
41 % substitute for non fit parameters
42 % subs for non fit parameters
43 for ii = 1:numel(H.objs)
44 H.objs(ii).subs(plist('Params', nonfitparnms, 'Values',nonfittruevals));
45 end
46
47
48 %% Linearize model
49
50 Hl = linearize(H);
51
52 %% Random test
53
54 % get random index
55 i1 = round(numel(Hl.objs)*rand(1)); % choose the parameter
56 i2 = round(numel(H.objs)*rand(1)); % choose the transfer function
57
58 % extract element to be tested
59 dH = Hl.objs{i1}.objs(i2);
60
61 % get the parameter name
62 pars = sort(usedparams);
63 prm = pars{i1};
64
65 % differentiate
66 tdH = diff(H.objs(i2),prm);
67
68 % evaluate response
69 dHr = eval(dH);
70 tdHr = eval(tdH);
71
72 % plot
73 iplot(dHr./tdHr)
74
75