Professional Documents
Culture Documents
Laboratory in Automatic Control Lab2
Laboratory in Automatic Control Lab2
Function (1/2)
Syntax
w = conv(u,v) r = roots(c) p = poly(r) v = polyval(p,x)
Example
p( s) s 1 s 1 s 1 q( s) s 3 3s 2 3s 1 p(5) 64
Matlab code
p=conv([1 1],conv([1 1],[1 1])) r=roots(p) q=[1 3 3 1] roots(q) poly(r) polyval(p,-5)
Function (2/2)
Example
U(s)
System
Matlab code
Method 1 num=[10];den=[1 0 5]; G1=tf(num,den); Method 2 G2=tf([10],[1 0 5]);
Y(s)
n1=[1 1];n2=[1 2]; d1=[1 2*i];d2=[1 -2*i];d3=[1 3]; % d1=[1 2*j];d2=[1 -2*j];d3=[1 3]; num=conv(n1,n2); den=conv(d1,conv(d2,d3)); H=tf(num,den)
Example
U(s)
System
Y(s)
Matlab code
G=tf([1 1],[1 3 2]) pole(G) zero(G) pzmap(G)
Example
Matlab code
% Transfer function convert to pole-zero [z,p,k] = tf2zp([1 1],[1 3 2]) % Pole-zero convert to transfer function [num, den] = zp2tf(z,p,k) transfer_function=tf(num, den)
Matlab code
sys = parallel(sys1,sys2)
2 s 5s 1 G (s) 2 s 2s 3 5( s 2) H ( s) s 10
2
Example
Lab Assignments
Solve Problems P1 and P2 Lab report should at least contain:
The MATLAB code and the plot for P1 The plot generated for P2 (Please plot all 3 curves on the same plot)
Lab Homework
P1. Consider the feedback system depicted in the figure. (a) Compute the closed-loop transfer function using the series and feedback functions. (b) Obtain the closed-loop system unit step response with the step function, and verify that final value of the output is 2/5.
Controller
R s
Plant
s2 s3
1 s 1
Y s
Lab Homework
P2. A system has a transfer function X s R s
15 / z s z
s 2 3s 15
Plot the response of the system when R s is a unit step for the parameter z 3, 6, and 12.