Sei sulla pagina 1di 2

MATLAB control-system toolbox tutorial

1. Define a transfer function:


15(1+𝑠) 15+15𝑠
Let us assume a close loop transfer function, 𝐺 = (3−𝑠)(5+𝑠) = −𝑠2 −2𝑠+15
The transfer function may be defined in state-space form:
A= [ 2 15
1 0]
B = [1
0]
C = [ -15 -15]
D= 0
• Use tf command:
G=tf ([15 15],[-1 -2 15])
• Use zero-pole-gain format
G=zpk([-1],[3 -5],15)
• Use state-space form
G=ss (A,B,C,D) when you have defined A, B, C and D before.

2. Conversion among different formats:


• tf2ss : [A B C D]= tf2ss ([15 15],[-1 -2 15])
• zp2ss: [A B C D]= zp2ss([-1],[3 -5],15) outputs of these two commands may be
different.
• ss2tf: [x y]=ss2tf(A,B,C,D) output gives the coefficients
• ss2zp: [x y z]=ss2zp(A,B,C,D)
• try all the possibilities

3. series and parallel and feedback:


15 (1+𝑠)
𝐺 = (3−𝑠) 𝐻 = (5+𝑠)
• series: T= series(G,H)
• parallel: T= parallel(G,H)
• feedback: T=feedback(G,H)

4. Stability of a control system:

• Routh’s criterion: no built-in command yet. However, many third-party functions are
available.
• Nyquist plot: Works on open-loop transfer function. Nyquist plot is the plot of the value
of open-loop transfer function when s is traversed through the positive half of s plane.
Here, N=Z-P: nyquist(G)
• Root-locus method: The locus of each root as gain K varies, is known as the root locus.
rlocus(H) : stable system as all the routes have negative real part.

5. Time/ transient response:


15(1+𝑠) 15+15𝑠
Assume the close loop transfer function, 𝐺 = (3−𝑠)(5+𝑠) = −𝑠2 −2𝑠+15
Define time matrix time_mat= linspace(0,1,1000))
• Impulse response : impulse(G,time_mat)
• Step response: step(G,time_mat)
• Response for arbitrary input:
Define time matrix and input
time_mat=0:0.1:20;
u=0.5*time_mat;
for i=101:1:201
u(i)=5;
end
A =tf([1],[0.2 1 1])

response: lsim(A,u,time_mat)
• Response for an initial condition: This works with state-space format only.
Define initial condition of state variables: x0=[1 -1]'
Response: find state space form: [AA,BB,CC,DD]=tf2ss([1],[1 0.1 10])
Only take the state space output: a2b=ss(AA,[],CC,[])
Initial(a2b,x0)

6. Frequency response:
15(1+𝑠) 15+15𝑠
Assume the close loop transfer function, 𝐺 = (3−𝑠)(5+𝑠) = −𝑠2 −2𝑠+15
• Bode plot: bode(G)
• Gain and phase margin: margin (G)

Potrebbero piacerti anche