view m-toolbox/html_help/help/ug/ng1D_content.html @ 51:9d5c88356247 database-connection-manager

Make unit tests database connection parameters configurable
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +0100
parents f0afece42f48
children
line wrap: on
line source


<p>
  <ul>
    <li><a href="#description">Description</a></li>
    <li><a href="#call">Call</a></li>
    <li><a href="#inputs">Inputs</a></li>
    <li><a href="#outputs">Outputs</a></li>
    <li><a href="#algorithm">Algorithm</a></li>
    <li><a href="#parameters">Parameters</a></li>
    <li><a href="#example">Example</a></li>
  </ul>
</p>

<h2><a name="description">Description</a></h2>

<p>
  noisegen1D is a coloring tool allowing the generation of colored noise from withe noise with a given spectrum. 
  The function constructs a coloring filter through a fitting procedure to the model provided. 
  If no model is provided an error is prompted. The colored noise provided has one-sided psd 
  corresponding to the input model.
</p>

<h2><a name="call">Call</a></h2>
<div class="fragment">
  <pre>
    b = noisegen1D(a, pl);
    [b1,b2,...,bn] = noisegen1D(a1,a2,...,an, pl);
  </pre>
</div>

<h2><a name="inputs">Inputs</a></h2>

<p>
  <ul>
    <li> a - is a tsdata analysis object or a vector of tsdata analysis objects
    <li> pl - is a plist with the input parameters. See the list of function parameters below
  </ul>
</p>

<h2><a name="outputs">Outputs</a></h2>

<p>
  <ul>
    <li> b - Colored time-series AOs. The coloring filters used
    are stored in the objects procinfo field under the
    parameter 'Filt'.
  </ul>
</p>

<h2><a name="algorithm">Algorithm</a></h2>

<p>
  <ol>
    <li> Fit a set of partial fraction z-domain filters using utils.math.psd2tf.
    <li> Convert to array of MIIR filters.
    <li> Filter time-series in parallel.
  </ol>
</p>

<h2><a name="parameters">Parameters</a></h2>
<p>
  <ul>
    <li> 'Model' - a frequency-series AO describing the model psd.
    <li> 'MaxIter' - Maximum number of iterations in fit routine
    [default: 30]
    <li> 'PoleType' - Choose the pole type for fitting:
      <ul>
        <li> 1 - use real starting poles.
        <li> 2  - generates complex conjugate poles of the
        type a.*exp(theta*pi*j)
        with theta = linspace(0,pi,N/2+1).
        <li> 3  - generates complex conjugate poles of the type
        a.*exp(theta*pi*j)
        with theta = linspace(0,pi,N/2+2) [default].
      </ul>
    </li>
    <li> 'MinOrder' - Minimum order to fit with. [default: 2].
    <li> 'MaxOrder' - Maximum order to fit with. [default: 25]
    <li> 'Weights'  - choose weighting for the fit: [default: 2]
      <ul>
        <li> 1 - equal weights for each point.
        <li> 2  - weight with 1/abs(model).
        <li> 3  - weight with 1/abs(model).^2.
        <li> 4  - weight with inverse of the square mean spread of the model.
      </ul>
    </li>
    <li> 'Plot' - plot results of each fitting step. [default: false]
    <li> 'Disp' - Display the progress of the fitting iteration.
    [default: false]
    <li> 'FitTolerance' - Log Residuals difference - Check if the minimum
    of the logarithmic difference between data and
    residuals is  larger than a specified value.
    ie. if the conditioning value is 2, the
    function ensures that the difference between
    data and residuals is at lest 2 order of
    magnitude lower than data itsleves. [Default: 2].
    <li> 'RMSEVar'  - Root Mean Squared Error Variation - Check if the
    variation of the RMS error is smaller than 10^(-b),
    where b is the value given to the variable. This
    option is useful for finding the minimum of Chi
    squared. [default: 7].
  </ul>
</p>

<h2><a name="example">Example</a></h2>

<div class="fragment">
  <pre>
  %% Noise generation from fsdata model object %%%%%%%%%%%%%%%%%%%%%%%%%%%

  % Description:
  % 1) Generate a fsdata object to be used as psd model
  % 2) Generate a random series of data (white)
  % 3) Generate colored noise with noisegen1D
  % 4) calculated psd of generated data
  % 5) check result by plotting

  % 1)
  fs = 10; % sampling frequency
  pl_mod1 = plist('fsfcn', '0.01./(0.01+f)', 'f1', 1e-6, 'f2', 5, 'nf', 100);
  mod1 = ao(pl_mod1); % fsdata model object

  % 2)
  % generating white noise
  a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 1000));

  % 3) Noise generation

  pl1 = plist(...
      'model', mod1, ...
      'MaxIter', 30, ...
      'PoleType', 2, ...
      'MinOrder', 10, ...
      'MaxOrder', 20, ...
      'Weights', 2, ...
      'Plot', false,...
      'Disp', false,...
      'RMSEVar', 5,...
      'FitTolerance', 2);

  ac1 = noisegen1D(a1, pl1);

  % 4)
  acxx1 = ac1.psd;
  % 5)
  iplot(acxx1, mod1);
  </pre>
</div>

<p>
  <div align="center">
    <IMG src="images/ng1D_1.png" width="800" height="600" align="center" border="0">
  </div>
</p>