ControlDesign - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim Toolboxes : MapleSim Control Design Toolbox : ControlDesign Package : State Estimation : ControlDesign/Kalman

ControlDesign

  

Kalman

  

design Kalman estimator for a given state-space system

 

Calling Sequence

Parameters

Options

Solvability Conditions

Description

Examples

References

Calling Sequence

Kalman(sys, G, H, Q, R, opts)

Parameters

sys

-

System; system object

G

-

Matrix; process noise matrix in the state equations

H

-

Matrix: process noise matrix in the output equations

Q

-

Matrix; process noise covariance matrix

R

-

Matrix; measurement noise covariance matrix

opts

-

(optional) equation(s) of the form option = value; specify options for the Kalman command

Options

• 

N = Matrix or Vector

  

The cross-correlation matrix between process and measurement noises. If omitted, a zero matrix with appropriate dimensions will be considered.

• 

output = gain or filter

  

Specifies whether the Kalman gains or the Kalman filter object must be returned. The default value is gain.

  

If gain, the Kalman gains and steady state estimation error covariance matrices are returned as follows:

– 

In the continuous-time domain, the gain matrix and steady state error covariance are returned as a sequence of L,P where L and P are as defined before.

– 

In the discrete-time domain, the gain matrix, the innovation gain, and the steady state error covariance matrices are returned as a sequence of L,M,P,Z where L, P, and M are as defined before and

  

Z=limnEen|nen|nT=IMCP,en|n=xnxˆn|n.

  

If filter, the Kalman filter is returned as a state-space DynamicSystems object. The structure of the filter depends on the time-domain and the value of option filtertype (for the discrete Kalman filter).

• 

filtertype =  current or delayed

  

Specifies the type of the discrete Kalman filter. The default value is current.

• 

parameters = {list, set}(name = complexcons)

  

Specifies numeric values for the parameters of sys. These values override any parameters previously specified for sys. The numeric value on the right-hand side of each equation is substituted for the name on the left-hand side in the sys equations. The default is the value of sys given by DynamicSystems:-SystemOptions(parameters).

Solvability Conditions

• 

The pair A,C must be detectable.

• 

The pair AN_R_1C,Q_N_R_1N_T must have no uncontrollable modes on the imaginary axis in continuous-time domain or on the unit circle in discrete-time domain

where Q_=GQGT, R_, and N_ are as defined before.

• 

R_>0 (positive definite) and Q_N_R_1N_T0 (positive semidefinite)

where Q_, R_, and N_ are as defined before.

Description

• 

The Kalman command designs the Kalman estimator for a given system and process and measurement noise covariance matrices.

• 

The system sys is a continuous or discrete-time linear system object created using the DynamicSystems package. The system object must be in state-space (SS) form.

• 

If sys contains structural uncontrollable or unobservable states, they are removed using ReduceSystem before computing the Kalman gains.  The resulting Kalman gains are then filled with zeros at positions corresponding to the removed states.

 

• 

Continuous-Time Kalman Estimator (Filter)

Given the continuous-time system

 

x=Ax+Bu+Gw

y=Cx+Du+Hw+v

 

with known (deterministic) inputs u, white process noise w, and white measurement noise v, satisfying

 

Ew=0    (process noise has zero mean value)

Ev=0    (measurement noise has zero mean value)

EwwT=Q

EvvT=R

EwvT=N

 

where Ea is the mathematical expectation of a, the Kalman filter provides an optimal state estimation that minimizes the steady state error covariance

 

P=limtExxˆxxˆT.

 

The Kalman filter equations are given as

 

xˆ=Axˆ+Bu+LyCxˆDu

x^y^=ICx^+00D0uy.

 

The gain matrix L is calculated as

 

L=PCT+N_R_1

 

where P is the solution of the corresponding algebraic Riccati equation and

 

R_=R+HN+HNT+HQHT

N_=GQHT+N.

 

• 

Discrete-Time Kalman Estimator (Filter)

Given the discrete-time system

 

xn+1=Axn+Bun+Gwn

yn=Cxn+Dun+Hwn+vn

 

and the noise covariance data

 

Ewn=0

Evn=0

EwnwnT=Q

EvnvnT=R

EwnvnT=N

 

the Kalman filter provides an optimal state estimation that minimizes the steady state error covariance

 

P=limnEen|n1en|n1T,en|n1=xnxˆn|n1.

 

The discrete Kalman filter state equation is given as

 

xˆn+1|n=Axˆn|n1+Bun+LynCxˆn|n1Dun

 

The gain matrix L is calculated as

 

L=APCT+N_CPCT+R_1

 

where  P is the solution of the corresponding algebraic Riccati equation and R_ and N_ are as defined before.

 

– 

The output equation structure depends on the type of the filter specified in the option filtertype:

 

– 

The current estimator uses all available measurements up to yn and generates state estimates xˆn|n and output estimates yˆn|n. The updated estimates are obtained from the prediction xˆn|n1 using the latest measurement yn as

 

xˆn|n=xˆn|n1+MynCxˆn|n1Dun.

 

ynCxˆn|n1Dun is called the innovation signal which (under Kalman optimality conditions) is white.

 

The innovation gain, M, is given as

 

M=PCTCPCT+R_1.

 

The output equation is given as

 

x^n|ny^n|n=IMCICMCx^n|n1+MDMICMDCMunyn.

 

– 

The delayed estimator uses measurements up to yn-1 and generates state estimates xˆn|n-1 and output estimates yˆn|n-1.

The output equation is given as

 

x^n|n1y^n|n1=ICx^n|n1+00D0unyn.

Examples

withControlDesign:

withDynamicSystems:

Design a Kalman filter for a continuous system

csysNewSystemMatrix1s+1,ss2+3s+2,3s+1s+4,ss2+1:

sysStateSpacecsys:

PrintSystemsys

State Spacecontinuous2 output(s); 2 input(s); 6 state(s)inputvariable=u1t,u2toutputvariable=y1t,y2tstatevariable=x1t,x2t,x3t,x4t,x5t,x6ta=010000−4−5000000010000001000000100−2−3−3−3b=001000000001c=410101300231d=0000

(1)

GLinearAlgebra:-IdentityMatrix6:

Q2LinearAlgebra:-IdentityMatrix63:

HMatrix1,0,0,1,2,2,0,3,5,7,1,2:

R2LinearAlgebra:-IdentityMatrix2:

KgcKalmansys,G,H,Q,R:

KgainKgc1

Kgain:=0.1924334636345310.006146964765979940.06430370435773440.02640396043786020.06381632034386280.06551692814324320.009783679001496630.09634736592923150.1084847890162120.09095268472944590.02542235060980900.0116225919671224

(2)

KcovKgc2

Kcov:=0.286190265024624212492164225579746732882932325926180.170932497504867297939640276688699097485465202521150.0230900857292271543636286400704422359548989795698380.197235895546496821446194886327489407987620223139990.0638298311281778159941460979160688762820641285952020.228595327629458286714156225393177356250027839323380.170932497504867297939640276688699097485465202521150.195825917421821659676124708193883159028608112557980.0577068815387494359655083787553019886927342486749660.128476486425958895657550052633088067277571289355250.00163860179183927628077241566218092309982885925982140.180268544636769036116588515478516442676598017962580.0230900857292271543636286400704422359548989795698380.0577068815387494359655083787553019886927342486749663.30560118828896042432455013835297616321626923501680.182693509776528835162129489169498397655702053978222.17883605119698965300952234580969667153029985622660.379405757254285016923843887573251004575636205187370.197235895546496821446194886327489407987620223139990.128476486425958895657550052633088067277571289355250.182693509776528835162129489169498397655702053978221.78594732849052721283262317805218980122340230093210.0507114046230494809666386067814443889717264176833541.64312343743137372890588342952241068711032726788180.0638298311281778159941460979160688762820641285952020.00163860179183927628077241566218092309982885925982142.17883605119698965300952234580969667153029985622660.0507114046230494809666386067814443889717264176833542.19150858111336271107458890070465478865493128291940.0248273744455952922909230340420171377409204652576070.228595327629458286714156225393177356250027839323380.180268544636769036116588515478516442676598017962580.379405757254285016923843887573251004575636205187371.64312343743137372890588342952241068711032726788180.0248273744455952922909230340420171377409204652576072.0297653609100465020733736810968951891825963803854

(3)

LinearAlgebra:-Eigenvaluessys:-aKgain.sys:-c

3.93877830228837+0.I2.47171603376280+0.I0.229038486136634+0.832844151778282I0.2290384861366340.832844151778282I1.15841822127975+0.302560027651275I1.158418221279750.302560027651275I

(4)

KfilterKalmansys,G,H,Q,R,'output'=filter:

PrintSystemKfilter

State Spacecontinuous8 output(s); 4 input(s); 6 state(s)inputvariable=u1t,u2t,y1t,y2toutputvariable=x1_obs_outt,x2_obs_outt,x3_obs_outt,x4_obs_outt,x5_obs_outt,x6_obs_outt,y1t,y2tstatevariable=x1_obst,x2_obst,x3_obst,x4_obst,x5_obst,x6_obsta=0.7881747488360650.80756653636546870.00.204727393166491160.0184408942979398180.198580428400511243.82199706388264334.9356962956422650.00.0114957834820139660.079211881313580590.037899743919874160.45181606580518070.063816320343862810.01.19485017663034920.196550784429729450.129333248487105980.3281768137936810.0097836790014966260.00.202478410859959630.71095790221230550.106131044930728130.70679721025318720.108484789016212390.00.29039015847510420.27285805418833770.80056252625434170.06682162653786870.0254223506098089982.02.9978228333244363.03486777590136742.9862002413573134b=0.00.00.19243346363453130.0061469647659799391.00.00.064303704357734360.0264039604378601970.00.00.063816320343862810.065516928143243160.00.00.0097836790014966260.09634736592923150.00.00.108484789016212390.09095268472944590.01.00.0254223506098089980.01162259196712243c=1000000100000010000001000000100000014.1.0.1.0.1.3.0.0.2.3.1.d=0000000000000000000000000.0.000.0.00

(5)

Design a Kalman filter for a discrete system:

dsysToDiscretecsys,1,'method'=bilinear:

sysStateSpacedsys:

KgcKalmansys,G,H,Q,R:

LKgc1

L:=0.1023573480910630.0002703116895050020.00002258727566445280.03163016967101120.03247782649604750.03040936849120180.07043098743519890.03205255326543810.1290707565617830.04892382684448250.1755064755984780.0836901687155676

(6)

MKgc2

M:=0.02536859137783490.005807363508801060.02746972472866040.0006767948608214790.02184462737542450.001782258655321430.03721335924767990.08205088025607220.002173109925082010.1034035631859300.02165159671334750.0367013113908555

(7)

PKgc3

P:=1.19003692563900783775861846283700396684753319914480.00233200860903450492498599386981059277220386411805310.00619988274226182212944558278729207805258749728971370.0147041924848130236225809366568813206860922028650710.269104757913207508049790732033382657287779229535500.178837262223932621453114029111603121359494791778240.00233200860903450492498599386981059277220386411805310.616706923971668092542179906886994108688428463131170.0629575750005459404632246547383052228031914171539720.0338084410601545143597413676619777791279345794979190.0768190024465848188369212978317591749773853067405450.154624466180982615441681742775226727756383255029780.00619988274226182212944558278729207805258749728971370.06295757500054594046322465473830522280319141715397214.0258493338218098567909220214505625082836294568597.43468819250785782760898387910188672545088608791703.569682476274454772090403331987200735667638130235211.1131081577137651463161600355227588485285617257550.0147041924848130236225809366568813206860922028650710.0338084410601545143597413676619777791279345794979197.434688192507857827608983879101886725450886087917013.4267277192343655429414968630716207084601983311507.51546139551865680850594672318365119060993524217863.44068633050188031779878026620132062274367453058800.269104757913207508049790732033382657287779229535500.0768190024465848188369212978317591749773853067405453.56968247627445477209040333198720073566763813023527.515461395518656808505946723183651190609935242178612.8669729877196992095723399102792834467189508494397.69162119351626916879875828631697696638869624988250.178837262223932621453114029111603121359494791778240.1546244661809826154416817427752267277563832550297811.1131081577137651463161600355227588485285617257553.44068633050188031779878026620132062274367453058807.691621193516269168798758286316976966388696249882512.493137943161183557844150615741546706412859530872

(8)

ZKgc4

Z:=1.181880871567360.008941293640510630.01053680607990540.03860742052595200.2286565652768680.1593046483501760.008941293640510630.6099216408521560.06819982175613770.03010774994236510.08312970994455280.1468824838076860.01053680607990540.068199821756137714.02145473592717.449864371295083.5591992415238511.11372020487410.03860742052595200.03010774994236517.4498643712950812.98431517133096.969751146593183.628443499921780.2286565652768680.08312970994455283.559199241523856.9697511465931812.17633524070157.445030563309660.1593046483501760.14688248380768611.11372020487413.628443499921787.4450305633096612.4006152930078

(9)

LinearAlgebra:-Eigenvaluessys:-aL.sys:-c

0.557923700713316+0.764621079517395I0.5579237007133160.764621079517395I0.329933413527070+0.I0.313799486006446+0.I0.178331258920455+0.146122594396005I0.1783312589204550.146122594396005I

(10)

KfilterKalmansys,G,H,Q,R,'output'=filter,'filtertype'=current:

PrintSystemKfilter

State Spacediscrete; sampletime = 18 output(s); 4 input(s); 6 state(s)inputvariable=u1q,u2q,y1q,y2qoutputvariable=x1_obs_outq,x2_obs_outq,x3_obs_outq,x4_obs_outq,x5_obs_outq,x6_obs_outq,y1q,y2qstatevariable=x1_obsq,x2_obsq,x3_obsq,x4_obsq,x5_obsq,x6_obsqa=0.015113993843835290.9545979491939030.0170595580185890180.026085905843943770.0236238819959112380.005556769727884890.105257018534626680.0105333511000995470.00000376454594482836980.0084289396095420850.030359692519849840.0151812265934372720.00081983468615568890.0042981333896351650.005412971083757180.9998092759371230.0216148342368918530.0127921731814076320.0044985623447860590.020618476658436060.0117384979082141780.0094516825869402840.98566344593104480.0114723929318084440.0100616256236059180.0410568384085261350.0215117927645996080.019938395078032790.016850363910589441.01631283929801230.0105027799464607920.050106155133568390.0292510792722632950.355867609856025951.36060894900018311.5029124117727788b=0.034074064078682460.0169514333427870160.102357348091062640.0002703116895050020.99473583414566450.012648303322459670.0000225872756644527640.0316301696710112460.0057577140813859730.00675077631272352160.032477826496047520.0304093684912017520.0181349035974104860.00108252339796107050.070430987435198880.032052553265438120.0348696143739142540.00194226202680659530.12907075656178350.048923826844482530.044553797071591670.99577501178603620.175506475598478480.0836901687155676c=0.99516625248056710.0132107173362059160.0042280985638181080.0080317147335591690.0114944069557648790.0041969006719947530.0041949212290114490.98756563516823170.0045782874556923930.00720051939478682550.0070593255021603920.00185095735157530950.00290619319244370470.0091146370586145160.99635922877003450.0051072469109897940.00338611141109566250.00035810625528860780.0096815171989199540.010811022640862980.0062022265425204331.01237015403940430.070085727889277720.037317013675655910.0188268657879077580.033502027758590080.0003621849875861060.027018933205410630.90123963832395370.049512982000065610.010004183103488920.021856702334031710.0036085994529463020.0153202021998248270.040285298167613961.01881949595178180.143720280496687450.431601748874952340.16209866622591750.248022199461551570.225033413156578460.053080528994539210.17220169434752440.30795432572997410.00188317878671133460.24749336791121190.89873482096957480.4500579093728716d=0.0094240910434264450.0065510439673385320.025368591377834930.0058073635088010580.009269374052130620.0048490054000209850.0274697247286604140.00067679486082147910.006984499348467040.0029278677678370030.0218446273754245270.00178225865532143030.00127069363076085830.0266181255599084280.037213359247679930.082050880256072160.0165095572261469180.040999240286785980.0021731099250820140.10340356318593020.0133340841367600680.0182891240092884970.0216515967133474940.036701311390855490.32386665188890230.161305033108459730.0274080028390133180.00198408279364446770.152721710387835890.37368818424248320.0112990727180081930.06107159242701374

(11)

KfilterKalmansys,G,H,Q,R,'output'=filter,'filtertype'=delayed:

PrintSystemKfilter

State Spacediscrete; sampletime = 1.8 output(s); 4 input(s); 6 state(s)inputvariable=u1q,u2q,y1q,y2qoutputvariable=x1_obs_outq,x2_obs_outq,x3_obs_outq,x4_obs_outq,x5_obs_outq,x6_obs_outq,y1q,y2qstatevariable=x1_obsq,x2_obsq,x3_obsq,x4_obsq,x5_obsq,x6_obsqa=0.015113993843835290.9545979491939030.0170595580185890180.026085905843943770.0236238819959112380.005556769727884890.105257018534626680.0105333511000995470.00000376454594482836980.0084289396095420850.030359692519849840.0151812265934372720.00081983468615568890.0042981333896351650.005412971083757180.9998092759371230.0216148342368918530.0127921731814076320.0044985623447860590.020618476658436060.0117384979082141780.0094516825869402840.98566344593104480.0114723929318084440.0100616256236059180.0410568384085261350.0215117927645996080.019938395078032790.016850363910589441.01631283929801230.0105027799464607920.050106155133568390.0292510792722632950.355867609856025951.36060894900018311.5029124117727788b=0.034074064078682460.0169514333427870160.102357348091062640.0002703116895050020.99473583414566450.012648303322459670.0000225872756644527640.0316301696710112460.0057577140813859730.00675077631272352160.032477826496047520.0304093684912017520.0181349035974104860.00108252339796107050.070430987435198880.032052553265438120.0348696143739142540.00194226202680659530.12907075656178350.048923826844482530.044553797071591670.99577501178603620.175506475598478480.0836901687155676c=1000000100000010000001000000100000010.14814814810.4444444444−0.16666666670.2555555556−0.23333333330.055555555560.18518518520.33333333330.0.2666666667−0.96000000000.4800000000d=0000000000000000000000000.33333333330.1666666667000.16666666670.400000000000

(12)

References

  

[1] F. Lewis, Optimal Estimation, John Wiley & Sons, 1986.

  

[2] G. F. Franklin, J. D. Powell and M. L. Workman, Digital Control of Dynamic Systems, 2nd Ed., Addison-Wesley, 1990.

See Also

ControlDesign

ControlDesign[LQR]

ControlDesign[StateFeedback][Ackermann]

ControlDesign[StateFeedback][PolePlacement]

ControlDesign[StateObserver][Ackermann]

ControlDesign[StateObserver][Observer]

ControlDesign[StateObserver][PolePlacement]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam