to have roots with negative real parts, the necessary and sufficient conditions are that:

Similar documents
Module 08 Observability and State Estimator Design of Dynamical LTI Systems

Module 03 Linear Systems Theory: Necessary Background

Topic # Feedback Control Systems

Modern Control Systems

LMIs for Observability and Observer Design

Module 07 Controllability and Controller Design of Dynamical LTI Systems

Topic # Feedback Control Systems

1. Type your solutions. This homework is mainly a programming assignment.

Problem Set 5 Solutions 1

+ γ3 A = I + A 1 (1 + γ + γ2. = I + A 1 ( t H O M E W O R K # 4 Sebastian A. Nugroho October 5, 2017

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science : Dynamic Systems Spring 2011

CONTROL DESIGN FOR SET POINT TRACKING

EL 625 Lecture 10. Pole Placement and Observer Design. ẋ = Ax (1)

Control Systems I. Lecture 4: Diagonalization, Modal Analysis, Intro to Feedback. Readings: Emilio Frazzoli

ME 234, Lyapunov and Riccati Problems. 1. This problem is to recall some facts and formulae you already know. e Aτ BB e A τ dτ

ME 132, Fall 2015, Quiz # 2

Linear Algebra. P R E R E Q U I S I T E S A S S E S S M E N T Ahmad F. Taha August 24, 2015

Observability. It was the property in Lyapunov stability which allowed us to resolve that

Control Systems Design

Control Systems Design

Observability and state estimation

Pole placement control: state space and polynomial approaches Lecture 2

Lecture 19 Observability and state estimation

16.31 Fall 2005 Lecture Presentation Mon 31-Oct-05 ver 1.1

Topic # Feedback Control. State-Space Systems Closed-loop control using estimators and regulators. Dynamics output feedback

Contents. 1 State-Space Linear Systems 5. 2 Linearization Causality, Time Invariance, and Linearity 31

6.241 Dynamic Systems and Control

1. The Transition Matrix (Hint: Recall that the solution to the linear equation ẋ = Ax + Bu is

ECEEN 5448 Fall 2011 Homework #4 Solutions

EE363 homework 7 solutions

FEL3210 Multivariable Feedback Control

1 (30 pts) Dominant Pole

5. Observer-based Controller Design

Stability, Pole Placement, Observers and Stabilization

MAE 143B - Homework 7

Module 09 From s-domain to time-domain From ODEs, TFs to State-Space Modern Control

Control System Design

Discrete and continuous dynamic systems

Linear System Theory

State Feedback and State Estimators Linear System Theory and Design, Chapter 8.

Problem 2 (Gaussian Elimination, Fundamental Spaces, Least Squares, Minimum Norm) Consider the following linear algebraic system of equations:

State Feedback and State Estimators Linear System Theory and Design, Chapter 8.

POLE PLACEMENT. Sadegh Bolouki. Lecture slides for ECE 515. University of Illinois, Urbana-Champaign. Fall S. Bolouki (UIUC) 1 / 19

SYSTEMTEORI - KALMAN FILTER VS LQ CONTROL

SYSTEMTEORI - ÖVNING Stability of linear systems Exercise 3.1 (LTI system). Consider the following matrix:

H 2 Optimal State Feedback Control Synthesis. Raktim Bhattacharya Aerospace Engineering, Texas A&M University

ẋ n = f n (x 1,...,x n,u 1,...,u m ) (5) y 1 = g 1 (x 1,...,x n,u 1,...,u m ) (6) y p = g p (x 1,...,x n,u 1,...,u m ) (7)

SYSTEMTEORI - ÖVNING 5: FEEDBACK, POLE ASSIGNMENT AND OBSERVER

Identification Methods for Structural Systems

Balanced Truncation 1

Autonomous system = system without inputs

Bayesian Analysis - A First Example

ACM/CMS 107 Linear Analysis & Applications Fall 2016 Assignment 4: Linear ODEs and Control Theory Due: 5th December 2016

Problem Set 4 for MAE280A Linear Systems Theory, Fall 2017: due Tuesday November 28, 2017, in class

2 Solving Ordinary Differential Equations Using MATLAB

Module 02 CPS Background: Linear Systems Preliminaries

EL2520 Control Theory and Practice

DESIGN OF OBSERVERS FOR SYSTEMS WITH SLOW AND FAST MODES

4 Optimal State Estimation

Solution of Linear State-space Systems

MODERN CONTROL DESIGN

Professor Fearing EE C128 / ME C134 Problem Set 10 Solution Fall 2010 Jansen Sheng and Wenjie Chen, UC Berkeley

Solutions. Chapter 1. Problem 1.1. Solution. Simulate free response of damped harmonic oscillator

1. Find the solution of the following uncontrolled linear system. 2 α 1 1

Nonlinear Observers. Jaime A. Moreno. Eléctrica y Computación Instituto de Ingeniería Universidad Nacional Autónoma de México

ECE 680 Linear Matrix Inequalities

State Regulator. Advanced Control. design of controllers using pole placement and LQ design rules

1 Continuous-time Systems

Intro. Computer Control Systems: F8

ECE 388 Automatic Control

Control Systems I. Lecture 7: Feedback and the Root Locus method. Readings: Jacopo Tani. Institute for Dynamic Systems and Control D-MAVT ETH Zürich

4F3 - Predictive Control

Lecture 10: Linear Matrix Inequalities Dr.-Ing. Sudchai Boonto

DESIGN OF LINEAR STATE FEEDBACK CONTROL LAWS

ECEEN 5448 Fall 2011 Homework #5 Solutions

Overview of Bode Plots Transfer function review Piece-wise linear approximations First-order terms Second-order terms (complex poles & zeros)

Controllability, Observability, Full State Feedback, Observer Based Control

Multivariable Control. Lecture 03. Description of Linear Time Invariant Systems. John T. Wen. September 7, 2006

21 Linear State-Space Representations

Intro. Computer Control Systems: F9

EEE582 Homework Problems

Control Systems I. Lecture 2: Modeling. Suggested Readings: Åström & Murray Ch. 2-3, Guzzella Ch Emilio Frazzoli

Some solutions of the written exam of January 27th, 2014

University of Toronto Department of Electrical and Computer Engineering ECE410F Control Systems Problem Set #3 Solutions = Q o = CA.

Stabilisation of Linear Time-Invariant Systems subject to Output Saturation

MAE143A Signals & Systems - Homework 5, Winter 2013 due by the end of class Tuesday February 12, 2013.

Problem 1 Cost of an Infinite Horizon LQR

18.06 Problem Set 7 Solution Due Wednesday, 15 April 2009 at 4 pm in Total: 150 points.

Linear System Theory. Wonhee Kim Lecture 1. March 7, 2018

Synthesis via State Space Methods

The roots are found with the following two statements. We have denoted the polynomial as p1, and the roots as roots_ p1.

Linear State Feedback Controller Design

Comparison of four state observer design algorithms for MIMO system

Analysis of undamped second order systems with dynamic feedback

sc Control Systems Design Q.1, Sem.1, Ac. Yr. 2010/11

Module 06 Stability of Dynamical Systems

Control Systems. Laplace domain analysis

+ i. cos(t) + 2 sin(t) + c 2.

Exam. 135 minutes, 15 minutes reading time

U(s) = 0 + 0s 3 + 0s 2 + 0s + 125

Transcription:

THE UNIVERSITY OF TEXAS AT SAN ANTONIO EE 543 LINEAR SYSTEMS AND CONTROL H O M E W O R K # 7 Sebastian A. Nugroho November 6, 7 Due date of the homework is: Sunday, November 6th @ :59pm.. The following LTI system is given: ẋ(t) = α x(t) + α u(t), y(t) = ] x(t). (a) Assume that α =. Find a state feedback controller u(t) = Kx(t) such that the closed loop evalues are both at. (b) Assume now that α is not known. Find the range of values of α that would make the statefeedback controlled system stable. That is, set u(t) = Kx(t) and find the range of values of α that would produce a stable closed loop system performance. (c) For the question in part (b), what is the percentage of change in α from α = that we considered in part (a), that the system can tolerate before becoming unstable? (d) Assume again that α =, and that x(t) is not available in real-time. This requires building a state estimator or an observer. Design an observer gain L such that the estimation error evalues are both at. (e) After solving (d), combine the controller from (a) with the observer in (d) to arrive at an observer-based state-feedback controller. (f) Implement the whole setup on MATLAB via the ode45 solver. Show that the observer is succeeding in estimating the system states. Consider that the estimator initial conditions are zero (i.e., ˆx() = ) and that the system s initial conditions are x() = ]. (g) Assume now that we connect the observer designed in part (d) with the system with unknown α in part (b). What are the values of α that would drive the observer-based controller system to stay stable? Hint: For any fourth order polynomial Answer: s 4 + a 3 s 3 + a s + a s + a = to have roots with negative real parts, the necessary and sufficient conditions are that: {a 3, a, a, a } >, a a a 3 a a 3 a >. (a) First, notice that the system is controllable, hence it is possible to design a state feedback control. The closed-loop dynamics with the controller is A cl = A BK = The characteristic polynomial of A cl is Since the desired poles are at, then k ] k = Det(λI A cl ) = λ + k λ + k + 4 =. λ + k λ + k + 4 = λ + λ + =. From the above, we get k = 3 and k =, hence K = 3 ]. k k ].

(b) From the structure of controllability matrix, it is true that the system is controllable for any α R. The closed-loop system with state feedback controller is A cl = A BK = α α The characteristic polynomial of A cl is k ] k = Det(λI A cl ) = λ + k λ + αk + α =. α α k k By using the value of K obtained from the previous calculation, the above equation becomes ]. λ + λ 3 α + α =. The roots of the characteristic polynomial equation can be analytically determined as λ, = ( ± 4 + 6α 4α ). For a stable system, then it is necessary to have ( ( Re(λ, ) = Re ± ) ) 4 + 6α 4α <. From the above, the roots are real if α = {.5, } and imaginary elsewhere, because when α = (,.5) or α = (, ), then 4 + 6α 4α <, hence the system is stable with Re(λ, ) =. Next, when α = {.5, }, then for the system to be stable, we have + 4 + 6α 4α < 4 + 6α 4α < 4 α(6 4α) <. Which implies α = (, ) or α = ( 3, ). Finally, it can be concluded that for the system to be stable with K = 3 ] is necessary to have α A where A = {x R x < x > 3 }. (c) From the above result, then the system is still stable until α > 3, which makes the tolerance limit to be 5% from. (d) Notice that the system is observable, hence it is possible to design an observer. The closedloop error dynamics is A cl = A LC = The characteristic polynomial of A cl is Since the desired poles are at, then l l ] ] = l Det(λI A cl ) = λ + l λ l + 4 =. λ + k λ + k + 4 = λ + λ + =. From the above, we get l = 3 and l =, hence L = 3 ]. l (e) The dynamics of observer-based state feedback control is ẋ (t) x (t) ẋ (t) ė (t) =.5.5 x (t).5 e (t). ė (t) e (t) where e = x ˆx. ].

5-5 - 3 4 5 6 7 8 9 - - -3 3 4 5 6 7 8 9 Figure : Trajectory of x and ˆx. (f) The simulation results for this observer-based state feedback control is given in Figure. It is obvious that the observer s states are converging to the system s states as t goes to infinity. The MATLAB code is given as follows %Homework 7 %Problem %Author: Sebastian A. Nugroho %System description sys.a = ; - ]; sys.b = ; ]; sys.c = ]; %Controller and observer matrices sys.k = -3/ ]; sys.l = 3/; ]; %Interval tff=; tspan = :.:tff; %Initial condition x = ; ]; xhat = ; ]; %Simulate system t, x] = ode45(@model, tspan, x; xhat], ], sys); %Plot figure figure(); 3

fs = 4; set(gcf, numbertitle, off, name, Estimation Error ); subplot(,,); plot(t,x(:,), r,t,x(:,3), b-., LineWidth,.5); grid on title( $x_$ vs $\hat{x}_$, interpreter, latex, FontName, Times New Roman ); xlabel( $\textrm{time\,(second)}$, interpreter, latex, FontName, Times New Roman, FontSize ylabel( $x_$ and $\hat{x}_$, interpreter, latex, FontName, Times New Roman, FontSize,fs set(gca, FontName, Times New Roman, fontsize,fs); h = legend( $x_$, $\hat{x}_$, Location, northeast ); set(h, Interpreter, latex ); set(h, Fontsize,fs); subplot(,,); plot(t,x(:,), r,t,x(:,4), b-., LineWidth,.5); grid on title( $x_$ vs $\hat{x}_$, interpreter, latex, FontName, Times New Roman ); xlabel( $\textrm{time\,(second)}$, interpreter, latex, FontName, Times New Roman, FontSize ylabel( $x_$ and $\hat{x}_$, interpreter, latex, FontName, Times New Roman, FontSize,fs set(gca, FontName, Times New Roman, fontsize,fs); h = legend( $x_$, $\hat{x}_$, Location, northeast ); set(h, Interpreter, latex ); set(h, Fontsize,fs); set(gcf, color, w ); %System dynamics function xtdot = model(t, xt, sys) %Extract vector x = xt(:); xhat = xt(3:4); % Control input u = -sys.k*xhat; % Plant xdot = sys.a*x + sys.b*u; y = sys.c*x; %Observer yhat = sys.c*xhat; xhatdot = sys.a*xhat + sys.b*u + sys.l*(y-yhat); %Combine vector xtdot = xdot; xhatdot]; end (g) The dynamics of observer-based state feedback control with unknown α is given as ẋ (t) α x (t) ẋ (t) ė (t) = α 3 3 α 3 x (t) e (t). ė (t) α e (t) The characteristic polynomial of the above is λ 4 + 4λ 3 + (4 + α )λ + 4α λ + α 4 9 4 α =. 4

In order to get a stable system, the following conditions must be satisfied 4 + α > 4α > α (α 9 4 ) > 6α (4 + α ) 6α (α 9 4 ) 6α4 = 5 4 α >. From the above conditions, it can be concluded that for the closed-loop system to be stable, then α A where A = {x R x < 3 x > 3 }.. The following autonomous LTI system is given: ẋ(t) = Ax(t) = x(t), y(t) = Cx(t) = ] x(t). (a) Is the above system observable? Prove that via the four tests of observability. (b) What is the unobservable subspace (if any)? (c) Is the above system detectable? (d) Design a Luenberger observer such that the closed loop estimation error dynamics have both evalues placed at. (e) Show an overall diagram of the dynamic system and the observer. (f) Find lim t e(t)? (g) Assume now we slightly change the dynamics of the system. Specifically, we change the A-matrix to:.9 Ā =. Answer: Given this slight change in matrix A, will the observer designed in the previous part yield converging and asymptotically stable estimation error dynamics or no? ẋ(t) ] Hint: Derive the closed loop dynamics of and investigate the stability of the closed ė(t) loop estimation error dynamics. (a) First, by the observability matrix, we have O = C = CA, which is rank deficient, hence it is unobservable. Second, by the PBH test, the eigenvalues of A are and. To proceed () I A Rank = Rank = C () I A Rank = Rank = C since not all are full rank, then according to the PBH test, the system is unobservable. Third, by the right eigenvector test, we have Cv = ] = Cv = ].447 =.8944.8944 5

since one of them is zero, then according to the eigenvector test, the system is unobservable. Fourth, by the observability Gramian, we have e Aτ = Te Dτ T e τ.5e = τ.5e τ ] e τ The observability Gramian is W = = = = t t t t e A τ C Ce Aτ dτ e τ ] e τ.5e τ.5e τ ].5e τ.5e τ e τ e τ dτ e τ.5e τ.5e τ ] e τ e τ dτ e τ dτ, since the matrix is of rank, then the observability Gramian matrix is not invertible, hence the system is unobservable. (b) The unobservable subspace is the nullspace of the observability matrix, that is () Null = c, for c R. (c) The system is indeed detectable, because for the unstable mode, the PBH test shows that () I A Rank = Rank =. C (d) The closed-loop error dynamics is A cl = A LC = The characteristic polynomial of A cl is Since the desired poles are at, then l l ] ] = l Det(λI A cl ) = λ + l λ + l =. λ + l λ + l = λ + λ + =. l From the above, we get l = whereas l an be any real number, hence we can choose to have L = ]. (e) The diagram of the plant and observer is shown in Figure. (f) We have ė(t) = (A LC)e(t) = ( The time domain solution is e(t) = e At e t te e() = t e t ]. ] ) e(t) = e(t). ] e () = e () e t e () + te t ] e () e t, e () hence lim e(t) = lim t t e t e () + te t ] e () e t = e (). 6

Figure : Plant-observer diagram. (g) The new dynamics is ẋ (t).9 x (t) ẋ (t) ė (t) = x (t).9 e (t). ė (t) e (t) Since the eigenvalues of the error dynamics are -.9 and -, then the observer s states are still converging to the system s states. 3. You are given a CT-LTI system defined by 3 A =, B = 4 3 ], C = ]. (a) Design a dynamic observer such that the error dynamics have eigenvalues at 4 and. First, you should derive the dynamics of the observer and explain how it works. Then, obtain a gain L that achieves the desired objective. (b) Finally, plot the norm of the estimation error dynamics, i.e., e(t) as a function of time given that the observer s initial conditions are ˆx() = ] and x() = ]. Consider that the input is u(t) = sin(t). Your plot should be a single plot versus time, since the norm function returns a scalar. Implement the whole setup on MATLAB via the ode45 solver. (c) How can you improve the convergence of the estimation error? Show that both analytically and via implementation. (d) Most systems are noisy, in the sense that the real dynamics are more like: ẋ(t) = Ax(t) + Bu(t) + w(t) where w(t) is the noise. Often, we assume that w(t) is a random variable with a well known distribution. Assume that w(t) is a white Gaussian noise. You can implement this via the randn or rand commands in MATLAB. For example, you can write in the ODE solver file w=.*randn(n,) which defines a vector of random quantities. Investigate whether the observer you designed in the above parts is robust enough to this noise signal in the state evolution. Of course, you should not add noise in the observer dynamics, but only in the state dynamics. You can change the scaling factor. to something smaller or bigger depending on the robustness of this observer. Can you draw any conclusions? 7

Answer: (a) The Luenberger observer is constructed as follows the error dynamics then can be obtained as ˆx(t) = A ˆx(t) + Bu(t) + L(y(t) ŷ(t)) = A ˆx(t) + Bu(t) + L(Cx(t) C ˆx(t)) = A ˆx(t) + Bu(t) + LC(x(t) ˆx(t)) ė(t) = ẋ(t) ˆx(t) = Ax(t) + Bu(t) (A ˆx(t) + Bu(t) + LC(x(t) ˆx(t)) = A(x(t) ˆx(t)) LC(x(t) ˆx(t)) = (A LC)(x(t) ˆx(t)) = (A LC)e(t) ( 3 l ] ) = e(t) 4 3 l 3 l = e(t) = A 4 l 3 cl e(t). Realize that the pair (A, C) is indeed observable. The characteristic polynomial of the above is λ + l λ + 3l l = Since the desired poles are at 4 and, then From the above, we obtain L = 6 4.5 ]. λ + l λ + 3l l = λ + 6λ + 8 =. (b) The simulation result is given is Figure 3. The MATLAB code is given below %Homework 7 %Problem 3a %Author: Sebastian A. Nugroho %System description sys.a = 3 -; 4-3]; sys.b = ; -]; sys.c = ]; %Controller and observer matrices sys.l = 6; 4.5]; %Interval tff=; tspan = :.:tff; %Initial condition x = ; ]; xhat = ; -]; %Simulate system t, x] = ode45(@model, tspan, x; xhat], ], sys); 8

9 8 7 6 5 4 3 3 4 5 6 7 8 9 Figure 3: Norm of estimation error. %Calculate the error norm e = ]; for i = :length(t) e = e; norm(x(i,)-x(i,3),) norm(x(i,)-x(i,4),)]]; end %Plot figure figure(); fs = 4; set(gcf, numbertitle, off, name, Norm of Estimation Error ); plot(t,e(:,), r,t,e(:,), b-., LineWidth,.5); grid on title( Norm of Estimation Error, interpreter, latex, FontName, Times New Roman ); xlabel( $\textrm{time\,(second)}$, interpreter, latex, FontName, Times New Roman, FontSize ylabel( $\Vert e(t)\vert_$, interpreter, latex, FontName, Times New Roman, FontSize,fs); set(gca, FontName, Times New Roman, fontsize,fs); h = legend( $\Vert e_(t)\vert_$, $\Vert e_(t)\vert_$, Location, northeast ); set(h, Interpreter, latex ); set(h, Fontsize,fs); set(gcf, color, w ); %System dynamics function xtdot = model(t, xt, sys) %Extract vector x = xt(:); xhat = xt(3:4); % Control input 9

u = *sin(*t); % Plant xdot = sys.a*x + sys.b*u; y = sys.c*x; %Observer yhat = sys.c*xhat; xhatdot = sys.a*xhat + sys.b*u + sys.l*(y-yhat); %Combine vector xtdot = xdot; xhatdot]; end (c) The convergence of the estimation can be increased by placing the eigenvalues of the error dynamics farther from the imaginary axis. For instance, if the desired poles are moved to 4 and 6, then λ + l λ + 3l l = λ + λ + 4 =. From the above, we obtain L =.5 ]. The simulation results are depicted in Figure 4. From the simulation, it is clear that the estimation states converge faster to the real states,hence making the error norm to be smaller. The MATLAB code are given below 9 8 7 6 5 4 3 3 4 5 6 7 8 9 Figure 4: Norm of estimation error. %Homework 7 %Problem 3b %Author: Sebastian A. Nugroho %System description sys.a = 3 -; 4-3];

sys.b = ; -]; sys.c = ]; %Controller and observer matrices sys.l = ;.5]; %Interval tff=; tspan = :.:tff; %Initial condition x = ; ]; xhat = ; -]; %Simulate system t, x] = ode45(@model, tspan, x; xhat], ], sys); %Calculate the error norm e = ]; for i = :length(t) e = e; norm(x(i,)-x(i,3),) norm(x(i,)-x(i,4),)]]; end %Plot figure figure(); fs = 4; set(gcf, numbertitle, off, name, Norm of Estimation Error ); plot(t,e(:,), r,t,e(:,), b-., LineWidth,.5); grid on title( Norm of Estimation Error, interpreter, latex, FontName, Times New Roman ); xlabel( $\textrm{time\,(second)}$, interpreter, latex, FontName, Times New Roman, FontSize ylabel( $\Vert e(t)\vert_$, interpreter, latex, FontName, Times New Roman, FontSize,fs); set(gca, FontName, Times New Roman, fontsize,fs); h = legend( $\Vert e_(t)\vert_$, $\Vert e_(t)\vert_$, Location, northeast ); set(h, Interpreter, latex ); set(h, Fontsize,fs); set(gcf, color, w ); %System dynamics function xtdot = model(t, xt, sys) %Extract vector x = xt(:); xhat = xt(3:4); % Control input u = *sin(*t); % Plant xdot = sys.a*x + sys.b*u; y = sys.c*x; %Observer yhat = sys.c*xhat; xhatdot = sys.a*xhat + sys.b*u + sys.l*(y-yhat);

%Combine vector xtdot = xdot; xhatdot]; end (d) With disturbance, the simulation results are given in Figure 5. The disturbance fails the estimation with the most significant influence happens after t = 7 seconds. This shows that the Luenberger observer only suitable for linear system without the presence of any disturbance. More advanced observer design is needed to overcome this disturbance. The MATLAB code is given below 9 8 7 6 5 4 3 3 4 5 6 7 8 9 Figure 5: Norm of estimation error. %Homework 7 %Problem 3c %Author: Sebastian A. Nugroho %System description sys.a = 3 -; 4-3]; sys.b = ; -]; sys.c = ]; %Controller and observer matrices sys.l = ;.5]; %Interval tff=; tspan = :.:tff; %Initial condition x = ; ]; xhat = ; -];

%Simulate system t, x] = ode45(@model, tspan, x; xhat], ], sys); %Calculate the error norm e = ]; for i = :length(t) e = e; norm(x(i,)-x(i,3),) norm(x(i,)-x(i,4),)]]; end %Plot figure figure(); fs = 4; set(gcf, numbertitle, off, name, Norm of Estimation Error ); plot(t,e(:,), r,t,e(:,), b-., LineWidth,.5); grid on title( Norm of Estimation Error, interpreter, latex, FontName, Times New Roman ); xlabel( $\textrm{time\,(second)}$, interpreter, latex, FontName, Times New Roman, FontSize ylabel( $\Vert e(t)\vert_$, interpreter, latex, FontName, Times New Roman, FontSize,fs); set(gca, FontName, Times New Roman, fontsize,fs); h = legend( $\Vert e_(t)\vert_$, $\Vert e_(t)\vert_$, Location, northeast ); set(h, Interpreter, latex ); set(h, Fontsize,fs); set(gcf, color, w ); % %Plot figure % figure(); % fs = 4; % set(gcf, numbertitle, off, name, Estimation Error ); % subplot(,,); % plot(t,x(:,), r,t,x(:,3), b-., LineWidth,.5); % grid on % title( $x_$ vs $\hat{x}_$, interpreter, latex, FontName, Times New Roman ); % xlabel( $\textrm{time\,(second)}$, interpreter, latex, FontName, Times New Roman, FontSi % ylabel( $x_$ and $\hat{x}_$, interpreter, latex, FontName, Times New Roman, FontSize, % set(gca, FontName, Times New Roman, fontsize,fs); % h = legend( $x_$, $\hat{x}_$, Location, northeast ); % set(h, Interpreter, latex ); % set(h, Fontsize,fs); % subplot(,,); % plot(t,x(:,), r,t,x(:,4), b-., LineWidth,.5); % grid on % title( $x_$ vs $\hat{x}_$, interpreter, latex, FontName, Times New Roman ); % xlabel( $\textrm{time\,(second)}$, interpreter, latex, FontName, Times New Roman, FontSi % ylabel( $x_$ and $\hat{x}_$, interpreter, latex, FontName, Times New Roman, FontSize, % set(gca, FontName, Times New Roman, fontsize,fs); % h = legend( $x_$, $\hat{x}_$, Location, northeast ); % set(h, Interpreter, latex ); % set(h, Fontsize,fs); % set(gcf, color, w ); %System dynamics function xtdot = model(t, xt, sys) %Extract vector x = xt(:); 3

xhat = xt(3:4); % Control input u = *sin(*t); %Disturbance w =.5*randn(,); % Plant xdot = sys.a*x + sys.b*u + w; y = sys.c*x; %Observer yhat = sys.c*xhat; xhatdot = sys.a*xhat + sys.b*u + sys.l*(y-yhat); %Combine vector xtdot = xdot; xhatdot]; end 4