**Useful Matlab
Functions and Scripts for Deterministic Systems EE611**

This page contains mfile downloads used in class examples. Mfiles are simply text(ascii) files. They can be copied and pasted into the Matlab editor or workspace, or downloaded to you computer from the links below. All mfiles were hastily written by Kevin D. Donohue, so some debugging may be required.

**Scripts**

LDEpolyn.m – This script generates a solution to a time invariant linear dynamical equation using the symbolic toolbox for the unit step and impulse inputs. The polynomial method is used to evaluate exp(At) and distinct eigenvalues of A are assumed.

LDEplolyn2.m – This script generates a solution to a time invariant linear dynamical equation using the symbolic toolbox for the unit step and impulse inputs. It uses Matlab's expm() function to evaluate exp(At).

DiscTimeEx.m – This script convert a continuous time linear dynamical equation to discrete time equivalent and solves for a step response. It uses the symbolic toolbox and Laplace methods to to evaluate exp(At).

ControlInput.m – This script computes the input required to transition on state to another over a finite time for a continuous-time linear dynamical system. It uses the symbolic toolbox, plots the input, and computes the energy of the controlling input.

ObserverOutput.m – This script computes the initial state based on the input and observed output over a finite time for a continuous-time linear dynamical system. It uses the symbolic toolbox and returns the initial stated computed from the output and the input.

kalmandex.m - This script computes the similarity transformation for the Kalman decomposition example in class. Note the script only works for this example. Number and dimensions had to be set throughout the script depending on the ranks of various matrices throughout the process. See comments in code.

DControlInput.m – This script computes the input required to transition on state to another over a finite number of samples for a discrete-time linear dynamical system. It uses the symbolic toolbox, plots the input, and computes the energy of the controlling input.

trackingex.m – This script solves an example tracking problem example to bring the settling time down to 2.5 seconds (within 2% of steady-state) with zero steady-state error. The commands ODE45 in the code requires that functions sp.m and spf.m be present in the current directory.

stabilizationex.m – This script solves a feedback design problem to stabilize a system that is not controllable.

redstateest.m – This script compute a reduced state estimator for a SISO class example.

miCCF.m – This script transforms a multiple input state equation into controllable canonical form.

mimoFO.m – This script computes a feedback vector and reduced state estimator for a multiple input and output state-space equation. The step response for the outputs are computed, where the inputs are all simultaneously excited with unit step functions..

mimoex2.mdl – This is a Simulink program that implements the system in the previous script (mimoFO.m).

**Functions**

sp.m –
This function evaluates a step response for a state equations (A and
B vectors coded inside the function) for use with the trackingex.m
script example. Coded **A** and **b** matrices are for the
original system in the trackingex.m
example.

spf.m –
This function evaluates a step response for a state equations (A and
B vectors coded inside the function) for use with the trackingex.m
script example. Coded **A** and **b** matrices are for the
feedback compensated system in the trackingex.m
example.