Académique Documents
Professionnel Documents
Culture Documents
Introduction
This effort is dedicated to helping students solve systems in Matlab (10). specially addressing the need to utilize Matlab as a computational tool
Writing an equation
Lets take any equation: F(s)=3s3+4s2+11s+5 Usually this can be realized through a matrix of coefficients A=[3 4 11 5] which may be further manipulated. To evaluate this at any value of s polyval(A,3) Where 3 is the value of s at which function is evaluated
Symbolic variables
syms s F = 3*s^3 + 4*s^2 + 11 *s + 5 This appears in workspace F= 3*s^3 + 4*s^2 + 11*s + 5 It works in previous versions of Matlab as well You can further simplify this as well simplify(F) This one being already in simplified form ans = 3*s^3 + 4*s^2 + 11*s + 5
Workspace Variables
Have a look at your workspace variables. This window is usually in top-right area of your default Matlab layout. You can go to each one of these and see their contents by double-clicking them
Variable Editor
Variable editor displays the contents of your variables including transfer functions. Here Im showing the G transfer function we just created Ill double click the num and den to show you
10
Extracting variables
Numerator coefficients
Solving a System in Matlab
Denominator coefficients
11
Or
>> impulse(G)
12
Step response
>> step(G) This Gives the figure shown left. We can right click in the window and enable viewing characteristics as peak response, settling time etc
13
Impulse response
>> impulse(G) This gives the impulse response and can be manipulated likewise
14
LTI View
Alternatively we can use the Linear Time Invarient View or LTIVIEW for short
>> ltiview An ltiview window will pop up. Well have to select from the system(s) present in the workspace.
15
Well have to select one or more of these systems for the plot. Ill select G
Solving a System in Matlab 16
Same plot as before. But in LTI viewer. Right click in the window and youll see a range of options to the type of plot you want to see. you can plot the Bode Magnitude and Phase 17
Bode Magnitude and Phase Plot There is a range of options you can use.
Solving a System in Matlab 18
ROOT LOCUS
19
Root Locus
Input
_ G(s) Output
>> rlocus(G)
This command plots the CLOSED LOOP poles of an OPEN LOOP transfer function .G. Note: we do not have to solve the system in closed loop first. We just enter the OPEN LOOP transfer function
Solving a System in Matlab 21
Poles and zeros on the right side of the imaginary axis means a stable system. Poles and zeros on the left side of imaginary axis means an unstable system. Furthermore, closer the poles to the imaginary axis, the less stable the system will be. 22
You can also enable the grid through right click menu. Frequency values along imaginary 23 axis and zeta (damping ratio) along real axis
Thank you..
Your feedback is welcome at: khurram_hashmi_pk@yahoo.com
Solving a System in Matlab 24