comparison m-toolbox/m/mdcs/mdc1_UTN/ltpda_free_dynamics.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 function varargout = ltpda_free_dynamics(varargin)
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DATA_REDUCTION converts interferometer data to acceleration
5 % data. This function returns the free dynamics without the action of the
6 % controller circuit. The commanded force has to be subtracted in order to
7 % obtain the output force noise
8 %
9 %
10 % CALL: b = ltpda_free_dynamics(varargin);
11 % ltpda_free_dynamics(varargin);
12 %
13 % INPUTS:
14 % - Aos containing the interferometer data. Aos must be supplied in
15 % couples.
16 % - plist containing the parasitic stiffness and the cross talk
17 % coefficient. The default structure of the plist is:
18 % plo = plist('pstiff1', -13e-7,'pstiff2', -20e-7,'cross_talk',
19 % -1e-4, 'METHOD', 'PARFIT')
20 % - 'pstiff1' is the square of the parasitic stiffness per unit of mass of TM1
21 % - 'pstiff2' is the square of the parasitic stiffness per unit of mass of TM2
22 % - 'cross_talk' is the sensitivity of the differential channel
23 % to x1
24 % - 'METHOD' define the method you want to use for the
25 % calculation of the derivatives. Possible values are:
26 % - 'PARFIT' makes use of the five points stencil parabolic
27 % fit approximation [1] to calculate the derivatives
28 % - 'SERIES' makes use of the five points stencil taylor
29 % series approximation [2] to calculate the derivatives
30 %
31 % Es: b = ltpda_free_dynamics(ao1, ao2);
32 %
33 % Es: b = ltpda_free_dynamics(ao1, ao2, pl);
34 %
35 %
36 %
37 % OUTPUTS:
38 % a vector of Aos containing the data obtained by the application of
39 % the free dynamics to the input data (interferometer data)
40 %
41 % REFERENCES:
42 % [1] L. Carbone et al., Physical Review D 75, 042001 (2007)
43 % [2] S. E. Koonin and D. C. Meredith, COMPUTATIONAL PHYSICS -
44 % Fortran Version, 1990, Westview Press
45 %
46 % VERSION: $Id: ltpda_free_dynamics.m,v 1.1 2008/04/24 16:13:12 luigi Exp $
47 %
48 % HISTORY: 18-03-2008 L Ferraioli
49 % Creation
50 %
51 %
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53
54
55
56 %% Standard history variables
57
58 ALGONAME = mfilename;
59 VERSION = '$Id: ltpda_free_dynamics.m,v 1.1 2008/04/24 16:13:12 luigi Exp $';
60 CATEGORY = 'Signal Processing';
61
62 %% Check if this is a call for parameters, the CVS version string
63 % or the method category
64 if nargin == 1 && ischar(varargin{1})
65 in = char(varargin{1});
66 if strcmpi(in, 'Params')
67 varargout{1} = getDefaultPL();
68 return
69 elseif strcmpi(in, 'Version')
70 varargout{1} = VERSION;
71 return
72 elseif strcmpi(in, 'Category')
73 varargout{1} = CATEGORY;
74 return
75 end
76 end
77
78 %% Collect input ao's, plist's and ao variable names
79 in_names = {};
80 for ii = 1:nargin
81 in_names{end+1} = inputname(ii);
82 end
83
84 [as, pl, invars] = collect_inputs(varargin, in_names);
85
86 % Checks that the input AOs come in pairs
87 if rem(length(as),2)
88 warning('The input AOs must come in pairs!');
89 return
90 end
91
92 % produce one parameter list
93 if isa(pl, 'plist')
94 pl = combine(pl, getDefaultPL());
95 else
96 pl = getDefaultPL();
97 end
98
99 %% Initialize outputs
100 % bs = [];
101
102 %% Defining Constants
103
104 fs = get(as(1),'fs');
105 wpx1 = find(pl, 'pstiff1');
106 wpx2 = find(pl, 'pstiff2');
107 dSD1 = find(pl, 'cross_talk');
108 T = 1/fs;
109
110 %% Defining plist for derivative functions
111
112 % In this case we need only second order derivatives and zero order in
113 % case we want to use the parabolic fit method
114 pl_2diff = plist('NAME', 'Second deriv plist', 'ORDER', 'SECOND');
115 pl_0diff = plist('NAME', 'Zero deriv plist', 'ORDER', 'ZERO');
116
117 %% Going through analysis objects
118
119 for jj = 1:2:numel(as)/2
120
121 % Extracts the input data
122 a1 = as(jj);
123 a2 = as(jj+1);
124
125 %% Applying "free dynamics" to data using the differentiation method
126 %% defined in the input plist
127 switch find(pl, 'METHOD')
128 case 'PARFIT'
129 d2_a1 = ltpda_parfit_derivative(a1, pl_2diff);
130 d0_a1 = ltpda_parfit_derivative(a1, pl_0diff);
131 d2_a2 = ltpda_parfit_derivative(a2, pl_2diff);
132 d0_a2 = ltpda_parfit_derivative(a2, pl_0diff);
133
134 b1 = d2_a1 + wpx1.*d0_a1;
135 b12 = -dSD1.*d2_a1 + (wpx2-wpx1-(dSD1*wpx2)).*d0_a1;
136 b22 = d2_a2 + wpx2.*d0_a2;
137 b2 = b12 + b22;
138 clear b12 b22
139
140 case 'SERIES'
141 d2_a1 = ltpda_series_derivative(a1, pl_2diff);
142 d2_a2 = ltpda_series_derivative(a2, pl_2diff);
143
144 b1 = d2_a1 + wpx1.*a1;
145 b12 = -dSD1.*d2_a1 + (wpx2-wpx1-(dSD1*wpx2)).*a1;
146 b22 = d2_a2 + wpx2.*a2;
147 b2 = b12 + b22;
148 clear b12 b22
149 end
150
151 % name, mfilename, description for these objects
152 b1 = setnh(b1, 'name', sprintf('ltpda_free_dynamics(%s)', invars{jj}),...
153 'description', find(pl,'description'));
154 b2 = setnh(b2, 'name', sprintf('ltpda_free_dynamics(%s)', invars{jj+1}),...
155 'description', find(pl,'description'));
156 % bs = [bs b1 b2];
157 % clear('b1', 'b2');
158
159 end
160
161 % %% Reshape the ouput to the same size of the input
162 %
163 % varargout{1} = reshape(bs, size(as));
164
165 %% outputs
166 if nargout == 2
167 varargout{1} = b1;
168 varargout{2} = b2;
169 elseif nargout == 1
170 varargout{1} = [b1 b2];
171 end
172 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173 %
174 % FUNCTION: getDefaultPL
175 %
176 % DESCRIPTION: Get default params
177 %
178 % HISTORY: 01-02-2008 M Hueller
179 % Creation
180 %
181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
182 function plo = getDefaultPL()
183
184 plo = plist('pstiff1', -13e-7,'pstiff2', -20e-7,'cross_talk', -1e-4,'METHOD', 'PARFIT', ...
185 'DESCRIPTION','Application of the free dynamics to interferometer data');
186
187
188
189
190
191
192
193