design Kalman estimator for a given state-space system - 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

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

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

csys:=NewSystemMatrix1s+1,ss2+3s+2,3s+1s+4,ss2+1:

sys:=StateSpacecsys:

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)

G:=LinearAlgebra:-IdentityMatrix6:

Q:=2LinearAlgebra:-IdentityMatrix63:

H:=Matrix1,0,0,1,2,2,0,3,5,7,1,2:

R:=2LinearAlgebra:-IdentityMatrix2:

Kgc:=Kalmansys,G,H,Q,R:

Kgain:=Kgc1

Kgain:=0.2213722366847730.01056971034016170.07861087576550220.02723534736474350.04286861316818220.1171068521562070.04912005700413730.1113226390327900.1347968066784730.1514303937715650.07698593500193880.00711532321866129

(2)

Kcov:=Kgc2

Kcov:=0.385447448362643705121072004428963047500113973755960.237945518304299559668038812796092896139867960647860.122463857206596295350150480751294837580547062141650.0834951423876573845789308104992058218422967936279610.0797105113186027275791282016322995667014798540706020.0385900587361850076527097822417603187666060333816800.237945518304299559668038812796092896139867960647860.251747951782501475871884615905451839073806579102560.100901406145284016570952771688890180923500684540720.0798326727203282619823767601229600830674087611965390.0656592029221680629655835168032741139433293438661630.0429359096768219196476721959555567857511086242434590.122463857206596295350150480751294837580547062141650.100901406145284016570952771688890180923500684540724.93539776643671503279212069958971278564762295511710.575977439932392138141152875547344787665143703901023.52373684874379849824753491021932208159102647013501.41453067817521092705598325953508747908904429597980.0834951423876573845789308104992058218422967936279610.0798326727203282619823767601229600830674087611965390.575977439932392138141152875547344787665143703901023.16539064780578998182335055836006435252807426972960.294218410512947273970672581149549074793702745339213.07798716425110550874248924322461133370598283369780.0797105113186027275791282016322995667014798540706020.0656592029221680629655835168032741139433293438661633.52373684874379849824753491021932208159102647013500.294218410512947273970672581149549074793702745339213.42920542499421029363318421230751305757214345170410.483260506592996339436511241120334141800168462667700.0385900587361850076527097822417603187666060333816800.0429359096768219196476721959555567857511086242434591.41453067817521092705598325953508747908904429597983.07798716425110550874248924322461133370598283369780.483260506592996339436511241120334141800168462667703.6374282844454924714849954060525824421664121182561

(3)

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

3.91551458983134+0.I2.67871981065422+0.I0.328265519260645+0.797440817909505I0.3282655192606450.797440817909505I1.12200383379418+0.378300076668940I1.122003833794180.378300076668940I

(4)

Kfilter:=Kalmansys,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.91719807775957530.77862776331522740.00.242511657365095970.03170913102048520.231941947024934263.76726253903222164.9213891242344980.00.0241401810360151530.081706042094230630.0513755284007586940.5227950091413510.0428686131681822460.01.2770823174805970.351320556468622040.159975465324389580.53044814511491810.049120057004137310.00.27176533506971650.66603208290163120.16044269603692690.99347840802858570.134796806678472660.00.43765759422160270.45429118131469510.71377279954996230.28659777035177120.076985935001938762.02.93724471143538373.02134596965598372.9301293882167228b=0.00.00.221372236684772520.0105697103401617321.00.00.078610875765502240.0272353473647435440.00.00.0428686131681822460.117106852156207340.00.00.049120057004137310.11132263903278960.00.00.134796806678472660.151430393771565030.01.00.076985935001938760.0071153232186612885c=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:

dsys:=ToDiscretecsys,1,'method'=bilinear:

sys:=StateSpacedsys:

Kgc:=Kalmansys,G,H,Q,R:

L:=Kgc1

L:=0.1077729503760810.001621607323375020.0009385331258247210.02911809895874520.03403507491817630.1223658798616890.04601306954137790.1476638051785940.1133753047461430.08144058435497300.1647894380744500.157149834791988

(6)

M:=Kgc2

M:=0.02189000677313820.002944159549697260.03346845845838230.002745192690166560.02500510035109910.005316777590827350.03965300175213400.1703508300615610.02042632480878000.2137191500916220.03635726445604610.0695964235814157

(7)

P:=Kgc3

P:=1.33901651391702457331873117572153814134009192588350.000914274795341542404855511919500029782601752216768090.0342202732218065613542906560229489687004345441940920.0529955625278114041875010252558634051310034059889560.0166906351616210303293211388795803368431174560288970.0371947225572190810144869964486816478370919587309550.000914274795341542404855511919500029782601752216768090.683135442832144014454552041314484380266242255189620.00932188065530167175755006219668245430621644972434900.00772032879657967103138552620305511102501174793022450.00156296460430280375054403263454754580131111718055010.0100977124898316887219667575468152462173714686998120.0342202732218065613542906560229489687004345441940920.009321880655301671757550062196682454306216449724349025.27110510342423620845333916366757417737535280547114.3289873382368474878026872265092286477688232040316.542668026403156025460290479347747085061426764480621.8911937670698275642893058388637905692866030992590.0529955625278114041875010252558634051310034059889560.007720328796579671031385526203055111025011747930224514.32898733823684748780268722650922864776882320403126.62379825997932383524899622497131411574902156913416.8500096891575115658417186696126032421074956789245.72697360061155256355024468982516117642464906365260.0166906351616210303293211388795803368431174560288970.00156296460430280375054403263454754580131111718055016.542668026403156025460290479347747085061426764480616.85000968915751156584171866961260324210749567892429.14862701434293941720634174092430126535852275548317.9014362835394894342707414933677349788437094395270.0371947225572190810144869964486816478370919587309550.01009771248983168872196675754681524621737146869981221.8911937670698275642893058388637905692866030992595.726973600611552563550244689825161176424649063652617.90143628353948943427074149336773497884370943952728.836234081356010607547223086603021660511596823968

(8)

Z:=Kgc4

Z:=1.333970869670460.008228473158896730.04042921488971560.08389692590610470.06948295917616530.01406668144013190.008228473158896730.6723498472503580.01811895956309940.03422027322180660.05299556252781140.01669063516162100.04042921488971560.018118959563099425.263238350845414.27061031776176.6320708007129621.92714966776760.08389692590610470.034220273221806614.270610317761724.604438436757614.32898733823686.542668026403160.06948295917616530.05299556252781146.6320708007129614.328987338236825.957131593312716.85000968915750.01406668144013190.016690635161621021.92714966776766.5426680264031616.850009689157528.4819603476763

(9)

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

0.541112756897320+0.734340965975144I0.5411127568973200.734340965975144I0.330125914957617+0.I0.312852831302459+0.I0.179055145788608+0.144231600507784I0.1790551457886080.144231600507784I

(10)

Kfilter:=Kalmansys,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.016266660669216770.95156037518496480.0179621583996059170.0279744048273104160.0267037647898883050.0067657576465833510.105857912495608960.0092889071546252890.000156422187668737920.0075249790332572270.0277343839376591360.0139245467680775660.017618114806259530.025661926670003140.0056725124874972241.02393304881146150.10952972718472580.056844784826071410.0205283980700275670.028771015279853880.0076688449250967520.0276181191576818220.86897912992368540.068322344829975470.00171475174354258560.0232421628581555430.0188958841281363120.0072561998337852190.0517287232013832751.03279285244129460.004688571181252810.0208564719570357020.027464906351234720.33353956709385631.287587027491421.4670563810967423b=0.036194584675717760.0186108013289559250.107772950376080920.00162160732337502160.99545982788114880.0114908173958293350.00093853312582472090.029118098958745180.0090492883427695050.043273839457178580.034035074918176330.12236587986168950.0092729443557622230.0513966771463407540.04601306954137790.147663805178593760.0242183375163915640.0136803496138529040.113375304746142810.081440584354973030.0287381735487541450.96460497243443940.164789438074450430.1571498347919881c=0.99621182130248550.010710278412772660.00364833446291936130.0063792220552610170.0079340614157964730.00262930807085954340.0054666591581568720.98421006534864810.0055780764108459910.0092851018790221520.0104446919577442890.00317705129410014070.0046890477537437650.0128856371275068890.99583248327398330.0078079996693923150.0109386299036176270.00394122548468204760.0256719312400343140.039160053703322770.00660883362667744061.0352933431160340.154284429781749720.079565453870905010.042603742588372160.08031808329018470.0034043874688108740.06221183413237170.79006347345570790.103719987845225720.0182744879918222520.03935759206254720.00605954407721958750.0278503472018767840.075295928346266511.0354261313372940.142010782930533650.42714559753454740.160805801626043020.245232997188661930.220318887337277030.051197316391248470.157379460605760970.278315602170100540.0046569627443200130.225446659291509280.83079466009797940.4171048829684549d=0.0077873621820307370.0048259982827982650.0218900067731381680.00294415954969725730.0116136849334644020.0066761534869126170.0334684584583822550.0027451926901665640.0092211630481813230.0062942277623476320.0250051003510991240.0053167775908273540.0151741377665488740.061531498397946790.039653001752134040.170350830061560570.04242863329130670.088892047505459550.020426324808779980.213719150091621680.0237184920833592820.0338981135097858740.0363572644560460760.069596423581415710.320776666534049570.158801953734716670.0351651904367087450.005009619728315840.136053159255037910.34422404056402480.0279417764603317260.12779749172913796

(11)

Kfilter:=Kalmansys,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.016266660669216770.95156037518496480.0179621583996059170.0279744048273104160.0267037647898883050.0067657576465833510.105857912495608960.0092889071546252890.000156422187668737920.0075249790332572270.0277343839376591360.0139245467680775660.017618114806259530.025661926670003140.0056725124874972241.02393304881146150.10952972718472580.056844784826071410.0205283980700275670.028771015279853880.0076688449250967520.0276181191576818220.86897912992368540.068322344829975470.00171475174354258560.0232421628581555430.0188958841281363120.0072561998337852190.0517287232013832751.03279285244129460.004688571181252810.0208564719570357020.027464906351234720.33353956709385631.287587027491421.4670563810967423b=0.036194584675717760.0186108013289559250.107772950376080920.00162160732337502160.99545982788114880.0114908173958293350.00093853312582472090.029118098958745180.0090492883427695050.043273839457178580.034035074918176330.12236587986168950.0092729443557622230.0513966771463407540.04601306954137790.147663805178593760.0242183375163915640.0136803496138529040.113375304746142810.081440584354973030.0287381735487541450.96460497243443940.164789438074450430.1571498347919881c=1000000100000010000001000000100000010.1481481481296296200.4444444443−0.1666666666999999940.255555555561111092−0.2333333333799999800.05555555555111107990.1851851852203703630.33333333340.0.266666666619999992−0.9599999999999999640.479999999900000085d=0000000000000000000000000.3333333332999999790.166666666699999994000.1666666666999999940.40000000000000002200

(12)

See Also

ControlDesign, ControlDesign[LQR], ControlDesign[StateFeedback][Ackermann], ControlDesign[StateFeedback][PolePlacement], ControlDesign[StateObserver][Ackermann], ControlDesign[StateObserver][Observer], ControlDesign[StateObserver][PolePlacement]

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.


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