view m-toolbox/html_help/help/ug/sigproc_example_matrix_linfitsvd_content.html @ 29:54f14716c721 database-connection-manager

Update Java code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source


<p>Iterative linear parameter estimation for multichannel systems - symbolic system model in frequency domain.</p>

<h2>Contents</h2>
<ul>
  <li><a href="#1">set plist for retriving</a></li>
  <li><a href="#2">retrive data</a></li>
  <li><a href="#3">Load input signal</a></li>
  <li><a href="#4">load Whitening filters</a></li>
  <li><a href="#6">Build input objects</a></li>
  <li><a href="#7">system model 1</a></li>
  <li><a href="#8">Do Fit</a></li>
  <li><a href="#9">system model 2</a></li>
  <li><a href="#10">Set Model Alias</a></li>
  <li><a href="#11">Do fit with alias</a></li>
</ul>

<h2>set plist for retriving<a name="1"></a></h2>

<div class="fragment"><pre>
  
  pl = plist(<span class="string">'hostname'</span>, <span class="string">'lpsdas01.esac.esa.int'</span>, <span class="string">'database'</span>, <span class="string">'ex6'</span>);
</pre></div>

<h2>retrive data<a name="2"></a></h2>

<div class="fragment"><pre>
  o1_1 = ao(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 169));
o12_1 = ao(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 170));

o1_2 = ao(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 171));
o12_2 = ao(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 172));
</pre></div>

<h2>Load input signal<a name="3"></a></h2>

<div class="fragment"><pre>
  is1 = matrix(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 173));
is2 = matrix(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 180));
</pre></div>

<h2>load Whitening filters<a name="4"></a></h2>
<span class="comment">% Stoc filter</span>

<div class="fragment"><pre>
  fil1 = filterbank(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 191));
fil2 = filterbank(pl.pset(<span class="string">'binary'</span>, <span class="string">'yes'</span>, <span class="string">'id'</span>, 192));
fil3 = filterbank(miir());
<span class="comment">% build matrix</span>
wf = matrix(fil1,fil3,fil3,fil2,plist(<span class="string">'shape'</span>,[2 2]));
</pre></div>

<h2>Build input objects<a name="6"></a></h2>

<div class="fragment"><pre>
  
  <span class="comment">% empty ao</span>
eao = ao();

<span class="comment">% exp_3_1</span>
os1 = matrix(o1_1,o12_1,plist(<span class="string">'shape'</span>,[2 1]));

<span class="comment">%  exp_3_2</span>
os2 = matrix(o1_2,o12_2,plist(<span class="string">'shape'</span>,[2 1]));

<span class="comment">% Input signals</span>
iS = collection(is1,is2);

<span class="comment">% Fit Params</span>
usedparams = {<span class="string">'A1'</span>,<span class="string">'A2'</span>,<span class="string">'S21'</span>,<span class="string">'w1'</span>,<span class="string">'w12'</span>,<span class="string">'del1'</span>,<span class="string">'del2'</span>};

nsecs = os1.objs(1).data.nsecs;
fs = os1.objs(1).data.fs;
npad = nsecs*fs;

<span class="comment">% set bounded params</span>
bdparams = {<span class="string">'del1'</span>,<span class="string">'del2'</span>};
bdvals   = {[0.1 0.3],[0.1 0.3]};

</pre></div>

<h2>system model 1<a name="7"></a></h2>

<div class="fragment"><pre>
  
  H = matrix(plist(<span class="string">'built-in'</span>,<span class="string">'ifo2ifo'</span>, <span class="string">'Version'</span>, <span class="string">'LSS v4.9.2 Phys Params'</span>));
</pre></div>

<h2>Do Fit<a name="8"></a></h2>

<div class="fragment"><pre>
  
  plfit = plist(<span class="keyword">...</span>
  <span class="string">'FitParams'</span>,usedparams,<span class="keyword">...</span>
  <span class="string">'Model'</span>,H,<span class="keyword">...</span>
  <span class="string">'Input'</span>,iS,<span class="keyword">...</span>
  <span class="string">'WhiteningFilter'</span>,wf,<span class="keyword">...</span>
  <span class="string">'tol'</span>,1,<span class="keyword">...</span>
  <span class="string">'Nloops'</span>,10,<span class="keyword">...</span>
  <span class="string">'Npad'</span>,npad,<span class="keyword">...</span>
  <span class="string">'Ncut'</span>,1e4);

opars1 = linfitsvd(os1,os2,plfit);
</pre></div>

<h2>system model 2<a name="9"></a></h2>

<div class="fragment"><pre>
  
  H2 = matrix(plist(<span class="string">'built-in'</span>,<span class="string">'ifo2ifo'</span>, <span class="string">'Version'</span>, <span class="string">'LSS v4.9.2 Phys Params Alias'</span>));
</pre></div>

<h2>Set Model Alias<a name="10"></a></h2>

<div class="fragment"><pre>
  
  plalias = plist(<span class="string">'nsecs'</span>,nsecs,<span class="string">'npad'</span>,npad,<span class="string">'fs'</span>,fs);
<span class="keyword">for</span> ii=1:numel(H2.objs)
  H2.objs(ii).assignalias(H2.objs(ii),plalias);
<span class="keyword">end</span>
</pre></div>

<h2>Do fit with alias<a name="11"></a></h2>

<div class="fragment"><pre>

plfit2 = plist(<span class="keyword">...</span>
  <span class="string">'FitParams'</span>,usedparams,<span class="keyword">...</span>
  <span class="string">'Model'</span>,H2,<span class="keyword">...</span>
  <span class="string">'BoundedParams'</span>,bdparams,<span class="keyword">...</span>
  <span class="string">'BoundVals'</span>,bdvals,<span class="keyword">...</span>
  <span class="string">'Input'</span>,iS,<span class="keyword">...</span>
  <span class="string">'WhiteningFilter'</span>,wf,<span class="keyword">...</span>
  <span class="string">'tol'</span>,1,<span class="keyword">...</span>
  <span class="string">'Nloops'</span>,10,<span class="keyword">...</span><span class="comment"> % maximum number of fit iterations</span>
  <span class="string">'Npad'</span>,npad,<span class="keyword">...</span>
  <span class="string">'Ncut'</span>,1e4); <span class="comment">% number of data points to skip at the starting of the series to avoid whitening filter transient</span>

opars2 = linfitsvd(os1,os2,plfit2);
</pre></div>