Example1.m
This script file will show the following: 1) How to interrogate Simulink's state definition 2) leveraging Simulink's state definition to map to your own 3) aligning state definition with eignvector elements
ADVICE: Did you know you can use the MATLAB debugger to step through this file line by line. Or use Cell Mode Execution to execute Cells at a time.
Contents
Clean Up
bdclose all clear all
We will look at the F14 model
extract the state information
statenames = getstatenames('f14');
Extract a linear model from this diagram
disp('If we linearize the F14 model') mysys=linmod('f14')
If we linearize the F14 model
mysys =
a: [10x10 double]
b: [10x1 double]
c: [2x10 double]
d: [2x1 double]
StateName: {10x1 cell}
OutputName: {2x1 cell}
InputName: {'f14/u'}
OperPoint: [1x1 struct]
Ts: 0
Calculate eigenvalues and eigenvectors
[v,d]=eig(mysys.a); d=diag(d); disp(['So the first eigenvalue of ' num2str(d(1))]) disp(' ... has the following eigenvector') strcat(strjust(num2str(v(:,1),3),'right'), repmat({' -> '},length(statenames),1), statenames)
So the first eigenvalue of -9.84322+9.5718i
... has the following eigenvector
ans =
' 1+0i -> Transfer Fcn.2'
' -0.0127+0.0177i -> Transfer Fcn.1'
' 0.00034+0.00207i -> Actuator Model'
' 2.58e-019-5.53e-020i -> W-gust model'
'-1.79e-020-1.19e-020i -> W-gust model'
'-5.86e-020-1.01e-019i -> Q-gust model'
'-7.31e-005-9.56e-005i -> Alpha-sensor Low-pass Filter'
' -0+0i -> Stick Prefilter'
' 0.00195+0.000167i -> Pitch Rate Lead Filter'
' -0.00136+0.00011i -> Proportional plus integral compensator'
Exercise 1
Can you change this script such that the complete state block path gets mapped to the eigenvector elements?
HINTS: -You only need to change 2 lines in this Example1.m script! -See what optional output arguments GETSTATENAMES can return
