In: Electrical Engineering
Sample Code and Models
Run each of the models below and explain the code function and your findings for each system, do they agree/disagree with what you understand and why ??
Matlab Code
% Winter 2018 Control Engineering
% Lab No.3 - Root Locus problems
% Mark Clarke
clear
s = tf('s')
K = 1150; %Proportional Controller Gain, May need to be altered?
% Enter Model 1
% This is a model of a simple 2nd order with no zeros
g1 = 1/((s+2)*(s+4));
h1 = feedback(K*g1,1);
figure(1)
rlocus(g1) % Plot the root locus of system g1
figure(2)
step (h1,5)% plot the step response of system h1
% Enter Model 2
% This is a model of a simple 2nd order with one zeros
g2 = (s+3)/((s+2)*(s+4));
h2 = feedback(K*g2,1);
figure(1)
rlocus(g2) % Plot the root locus of system g2
figure(2)
step (h2,5)% plot the step response of system h2
% Enter Model 3
g3 = 1/((s*(s^2 + 15*s + 60)));
h3 = feedback(K*g3,1);
g4 = 1/((s+1)*(s^2 + 15*s + 60));
h4 = feedback(K*g4,1);
figure(1)
rlocus(g3) % run the root locus on the g3 an g4 above
figure(2)
step(h3,10) % run the step response on the h3 an h4 above
PART 2 Findings and Conclusion
u can directly run the below code on matlab:
clc;
clear all;
close all;
s=tf('s');
k=1150; % gain
% model 1
g1=1/((s+2)*(s+4));
h1=feedback(k*g1,1);% closed loop transfer function
rlocus(g1);% root locus of g1 (open loop)
figure
step(h1,5);grid % step response
% model 2
g2=(s+3)/((s+2)*(s+4));
h2=feedback(k*g2,1);% closed loop transfer function
figure
rlocus(g2);% root locus of g2 (open loop)
figure
step(h2,5);grid % step response
% model 3
g3=1/(s*(s^2+15*s+60));
h3=feedback(k*g3,1);% closed loop transfer function
g4=1/((s+1)*(s^2+15*s+60));
h4=feedback(k*g4,1);% closed loop transfer function
figure
rlocus(g3,g4);% root locus of g3 and g4 (open loop)
figure
step(h3);grid % step response of h3
figure
step(h4);grid % step response of h4
from the responses;
h1,h2 are stable systems and h3 and h4 are unstable systems