Home > m > timetools > statespacefunctions > utp_ltpda_ss_kalman_filter.m

utp_ltpda_ss_kalman_filter

PURPOSE ^

tests ltpda_simulate_discrete which simulates a discrete state space system

SYNOPSIS ^

function varargout = utp_ltpda_ss_kalman_filter(varargin)

DESCRIPTION ^

tests ltpda_simulate_discrete which simulates a discrete state space system
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: tests ltpda_simulate_discrete whichsimulates a discrete
 state space system

 CALL: utp_ltpda_simulate_discrete

 INPUTS: 
 
 OUTPUTS: result - 1/0

 ***** THERE ARE NO DEFAULT PARAMETERS *****

 &&VERSION: $Id: utp_ltpda_ss_kalman_filter.m,v 1.3 2008/03/11 16:52:56 adrien Exp $

 HISTORY: 17-02-2008 A Grynagier

 TO DO: Numerical and syntaxic tests
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = utp_ltpda_ss_kalman_filter(varargin)
0002 %tests ltpda_simulate_discrete which simulates a discrete state space system
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % DESCRIPTION: tests ltpda_simulate_discrete whichsimulates a discrete
0006 % state space system
0007 %
0008 % CALL: utp_ltpda_simulate_discrete
0009 %
0010 % INPUTS:
0011 %
0012 % OUTPUTS: result - 1/0
0013 %
0014 % ***** THERE ARE NO DEFAULT PARAMETERS *****
0015 %
0016 % &&VERSION: $Id: utp_ltpda_ss_kalman_filter.m,v 1.3 2008/03/11 16:52:56 adrien Exp $
0017 %
0018 % HISTORY: 17-02-2008 A Grynagier
0019 %
0020 % TO DO: Numerical and syntaxic tests
0021 %
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 ALGONAME = mfilename;
0024 VERSION = '$Id: utp_ltpda_ss_kalman_filter.m,v 1.3 2008/03/11 16:52:56 adrien Exp $';
0025 CATEGORY = 'STATESPACE';
0026 display(['starting ' ALGONAME]);
0027 
0028 if not(isempty(varargin))
0029     if isequal( varargin{1}, 'Version')
0030         varargout = VERSION;
0031         return;
0032     elseif isequal(varargin{1}, 'Params')
0033         varargout = plist();
0034         return;
0035     elseif isequal(varargin{1}, 'Category')
0036         varargout = CATEGORY;
0037         return;
0038     end
0039 end
0040 result = 1;
0041  
0042 %% create subsystem
0043 %% test numerique
0044 try
0045     A=expm([0 1; -2 -1]*0.2);
0046     B1=[0;1];
0047     C=[2 -1];
0048     D1=1;
0049     B2=[0;0];
0050     D2=1;
0051     B3 = [0; 1];
0052     D3 = 0;
0053     sigma2 = 0.5;
0054     mean2 = 3;
0055     sigma3 = 0.1;
0056     mean3 = 0;
0057     syst = plist('TYPE', 'SUBSYSTEM' ,'NAME', 'SS1' ,'TIMESTEP', 1 , ...
0058         'XISOUTPUT',0,'YISOUTPUT',1,'XINI', [0 0]' , ...
0059         'PARAMNAMES', {} ,'PARAMVALUES', [] ,'PARAMSIGMAS', [] ,...
0060         'NBINPUTS', 3 ,'INPUTNAMES', {'U' 'V' 'W'} ,'INPUTSIZES', [1 1 1] , 'INPUTISUSED', [1 1 1] ,...
0061         'AMAT', {A} ,'BMATS', {B1 B2 B3} ,'CMAT', {C} ,'DMATS', {D1 D2 D3} );
0062     ao1 = ao(sin((1:100)'/3));
0063     ao_in_list = plist('U',ao1, 'V', plist('SIGMA', sigma2, 'MEAN',mean2),'W',plist('SIGMA', sigma3, 'MEAN',mean3));
0064     ao_out = ltpda_ss_simulate(ao_in_list, syst);
0065     
0066     data_plist = plist('Qs',{0 sigma3^2+mean3^2},'Rs',{sigma2^2+mean2^2 0},'Noise_Names',{'V' 'W'} );
0067 
0068     ao_in_list2 = plist('U',ao1);
0069     ao_id = ltpda_ss_kalman_filter(ao_out, ao_in_list2, data_plist, syst);
0070 
0071     figure(1)
0072     plot(ao_out)
0073     figure(2)
0074     plot(ao_id)
0075     
0076     ao_id = ltpda_ss_kalman_filter([ao_out, ao_out], [ao_in_list2, ao_in_list2, ao_in_list2], [data_plist, data_plist], [syst,syst,syst]);
0077 
0078 catch
0079     result = 0;
0080 end
0081 varargout = {result};
0082 
0083 end

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003