Reputation: 13
i'm with these 3 plots generated by the figure function and 1 plot by rlocus and what i'm trying to do is to put these 4 plots in the same window, like subplot function does. I tried to use it but it didn't work and also i prefer to use figure function rather than plot function because of the default properties, so now i'm searching for some alternatives. Thanks in advance.
num1=1;
den1=[1,3,3,1];
G=tf(num1,den1);
for Kp=[0.1:0.1:1]
G_c=feedback(Kp*G,1);
step(G_c);
hold on
end
figure
Kp=1;
s=tf('s');
for Ti=[0.7:0.1:1.5]
Gc=Kp*(1+1/Ti/s);
G_c=feedback(G*Gc,1);
step(G_c);
hold on
end
figure
Ti=1;
s=tf('s');
for Td=[0.1:0.2:2]
Gc=Kp*(1+1/Ti/s+Td*s);
G_c=feedback(G*Gc,1);
step(G_c);
hold on
end
figure
rlocus(G,[0,15])
Upvotes: 1
Views: 156
Reputation: 20514
I am not sure what you mean by you prefer figure function to plot function. My understanding is that plot uses the active or referenced figure. If you want multiple graphs in a window this is what subplot
does.
Is this not what you want:
Using subplot:
subplot(2,2,1)
num1=1;
den1=[1,3,3,1];
G=tf(num1,den1);
for Kp=[0.1:0.1:1]
G_c=feedback(Kp*G,1);
step(G_c);
hold on
end
subplot(2,2,2)
Kp=1;
s=tf('s');
for Ti=[0.7:0.1:1.5]
Gc=Kp*(1+1/Ti/s);
G_c=feedback(G*Gc,1);
step(G_c);
hold on
end
subplot(2,2,3)
Ti=1;
s=tf('s');
for Td=[0.1:0.2:2]
Gc=Kp*(1+1/Ti/s+Td*s);
G_c=feedback(G*Gc,1);
step(G_c);
hold on
end
subplot(2,2,4)
rlocus(G,[0,15])
Upvotes: 1