Instructions for Lab StudentsÂ
-------------------------------------------------------------------
Online Software Link:Â
 MATLAB Â
-------------------------------------------------------------------
To obtain the transfer function from given zeros and poles using MATLAB.
A transfer function represents the ratio of Laplace transform of output to input assuming zero initial conditions.
z = input('Enter zeros: ');
p = input('Enter poles: ');
k = input('Enter gain: ');
[num, den] = zp2tf(z,p,k);
tf(num,den);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To determine poles and zeros from a given transfer function.
Poles are roots of the denominator. Zeros are roots of the numerator polynomial.
num = input('Enter numerator: ');
den = input('Enter denominator: ');
[z,p,k] = tf2zp(num,den);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To analyze the step response of a system.
Step response gives rise time, settling time, overshoot and steady state error.
num = input('Enter numerator: ');
den = input('Enter denominator: ');
G = tf(num,den);
step(G);
stepinfo(G);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To obtain impulse response of a system.
Impulse response represents system reaction to sudden input change.
num = input('Enter numerator: ');
den = input('Enter denominator: ');
G = tf(num,den);
impulse(G);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To study system stability using root locus.
Root locus shows movement of closed loop poles as gain varies.
num = input('Enter numerator: ');
den = input('Enter denominator: ');
G = tf(num,den);
rlocus(G);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To analyze frequency response using Bode plot.
Bode plot gives gain margin and phase margin.
num = input('Enter numerator: ');
den = input('Enter denominator: ');
G = tf(num,den);
bode(G);
margin(G);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To analyze system stability using Nyquist criterion.
Nyquist plot determines stability from encirclements of -1 point.
num = input('Enter numerator: ');
den = input('Enter denominator: ');
G = tf(num,den);
nyquist(G);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To determine system stability using Routh array.
Routh criterion determines number of right half plane poles without solving equation.
den = input('Enter denominator: ');
roots(den);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To design and analyze PID controller.
PID controller improves transient and steady-state performance.
G = tf([1],[1 3 2]);
C = pid(1,1,1);
T = feedback(C*G,1);
step(T);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.
To model system using state space representation.
State space model describes system using matrices A, B, C, D.
A = [0 1; -2 -3];
B = [0;1];
C = [1 0];
D = 0;
sys = ss(A,B,C,D);
step(sys);
eig(A);
1. Open MATLAB.
2. Enter the program.
3. Run the script.
4. Record outputs and graphs.
5. Analyze results.