0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % SINEPARAMS estimates parameters of sinusoids
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: SINEPARAMS estimates the parameters of the sinusoids in the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % time series. Number of sinusoids needs to be specified.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % CALL: b = sineParams(a,pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % INPUTS: a - input AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % pl - parameter list (see below)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % OUTPUTs: b - pest object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'sineParams')">Parameters Description</a>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % VERSION: $Id: sineParams.m,v 1.9 2011/04/08 08:56:13 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 function varargout = sineParams(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % Check if this is a call for parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 if utils.helper.isinfocall(varargin{:})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 varargout{1} = getInfo(varargin{3});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 import utils.const.*
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % Collect input variable names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 in_names = cell(size(varargin));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 for ii = 1:nargin,in_names{ii} = inputname(ii);end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % Collect all AOs and plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 [aos, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 %%% Decide on a deep copy or a modify
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 bs = copy(aos, nargout);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % combine plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 pl = parse(pl, getDefaultPlist());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 % check (current version with only one AO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 if numel(aos) >1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 error('### Current version of ''sineParams'' works only with one AO')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % get parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 Nsine = find(pl, 'N');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 realSine = find(pl, 'real');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 method = find(pl,'method');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 nonlin = find(pl,'non-linear');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 % check number of sinusoids
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 if isempty(Nsine)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 error('### You need to set the number of sinusoids ''N'' ')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 if realSine
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 Nexp = 2*Nsine;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 Nexp = Nsine;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 f =[];A=[];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 % for i = 1:numel(bs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 switch method
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 case 'MUSIC'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 % MUSIC algorithm
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 [w,pow,w_mse,pow_mse] = utils.math.rootmusic(bs.y,Nexp,bs.fs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 if realSine
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 f = w(1:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 df = w_mse(1:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 % A = pow;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 % dA = pow_mse;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 A = sqrt(2*pow); % from the expression for power in a sinusoid
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 dA = 1/sqrt(2*pow)*pow_mse;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 f = w;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 df = w_mse;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 A = sqrt(2*pow); % from the expression for power in a sinusoid
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 dA = A*sqrt(2/pow)*pow_mse;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 case 'ESPRIT'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 % p = 1; % num. sinusoid
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 % N = 50;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 % m = xcov(c.y,N-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 % clear cmat
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 % for i =1:N
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 % cmat(i,:) = m(N-(i-1):end-(i-1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 % [U,S,UT] = svd(cmat);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 % D = diag(S);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 % Ls = D(1:2*p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 % Us = U(:,1:2*p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 % A1 = Us(1:end-1,:);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 % A2 = Us(2:end,:);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 % M = A1\A2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 % freq = imag(-log(eig(M))/2/pi*fs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 % error = real(-log(eig(M))/2/pi*fs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 case 'IFFT'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 % % fft
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 % p = psd(phi(i),plist('win','Hanning','scale','AS','Navs',1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 % [m,index] = max(p.y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 % ratio between max. and next value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 % alpha = p.y(index+1)/p.y(index);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 % xm = (2*alpha-1)/(alpha+1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 % frequency
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 % f(i) = (i+xm)/phi(i).nsecs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 % amplitude
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 % A(i) = abs(2*pi*xm*(1-xm)/sin(pi*xm)*exp(-pi*1i*xm)*(1*xm)*p.y(i));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 % create output pest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 mdl = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 p = pest();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 for i = 1:Nsine
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 Cname = sprintf('C%d',i);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 fname = sprintf('f%d',i);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 Aname = sprintf('A%d',i);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 pname = sprintf('phi%d',i);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 % setY
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 p.setYforParameter(Cname,0);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 p.setYforParameter(Aname,A(i));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 p.setYforParameter(fname,f(i));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 p.setYforParameter(pname,0);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 % errors for single sinusoid only, error is the sqrt(mse)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 if Nsine == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 p.setDyForParameter(Cname,inf);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 p.setDyForParameter(Aname,sqrt(dA(i)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 p.setDyForParameter(fname,sqrt(df(i)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 p.setDyForParameter(pname,inf);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 % smodel for each sinusoid
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 m = smodel(sprintf('%s + %s*sin(2*pi*%s*t+%s)',Cname,Aname,fname,pname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 m.setXunits('s');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 m.setXvar('t');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 m.setXvals(bs.x);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 m.setParams({Cname,Aname,fname,pname},[0 A(i) f(i) 0]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 % optional non-linear
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 if nonlin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 pl = plist('Function',m);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 pnl = xfit(bs,pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 p.setY(pnl.y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 p.setDy(pnl.dy);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 p.setCorr(pnl.corr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 p.setCov(pnl.cov);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 p.setDof(pnl.dof);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 p.setChi2(pnl.chi2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 % set values in model as well
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 m.setValues(pnl.y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 mdl = [mdl m];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 % set name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 p.name = sprintf('sineParams(%s)', ao_invars{:});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 % set models
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 p.setModels(mdl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 % Add history
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 p.addHistory(getInfo('None'), pl, ao_invars(:), bs(:).hist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 varargout{1} = p;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 % Get Info Object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 function ii = getInfo(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 if nargin == 1 && strcmpi(varargin{1}, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 sets = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 pl = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 sets = {'Default'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 pl = getDefaultPlist;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 % Build info object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: sineParams.m,v 1.9 2011/04/08 08:56:13 hewitson Exp $', sets, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 % Get Default Plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 function plout = getDefaultPlist()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 persistent pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 if exist('pl', 'var')==0 || isempty(pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 pl = buildplist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 plout = pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 function pl = buildplist()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 % number of sinusoids
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 p = param({'N', 'Number of sinusoids/complex exp. in the time series'},paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 % number of sinusoids
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 p = param({'real', 'Set to true if working with real sinusoids'},paramValue.TRUE_FALSE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 % number of sinusoids
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 p = param({'method', ['Choose one of the following methods:<ul>', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 '<li>MUSIC - MUltiple SIgnal Classification algorithm </li>']}, {1, {'MUSIC'}, paramValue.SINGLE});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 % non-linear
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 p = param({'non-linear','Set to true to perform non-linear fit'},...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 paramValue.FALSE_TRUE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 % END
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241
|