Reputation: 4972
I need to see at which values of kc
a system is stable and unstable.
The system has the following transfer function:
(-2Kc)/(s^4+3s^3+4s^2+3s+(1-2kc) )
After calculations, for this system to be stable, kc should be in this range of values:
-1 < Kc < 0.5
I am using matlab, and added the following to plot the transfer function response for each value of Kc from -2 to 1 with a step of 0.1:
syms s kc;
t=(-2*kc)/(s^4+3*s^3+4*s^2+3*s+1-2*kc);
kc=-2:0.1:1;
plot(t)
I got the following errors:
Error using plot Data must be numeric, datetime, duration or an array convertible to double.
Error using plot. Not enough input arguments.
I tried to step
function but got the same error.
Upvotes: 0
Views: 1842
Reputation: 2149
The error message says that t
is not a numeric array. t
is a symbolic object; the plot
function knows nothing about symbolic objects and can't handle them properly. The second issue is that the kc
variable definition
kc=-2:0.1:1;
has no effect because it does not affect the content of the symbolic object t
.
There is a function ezplot
, which plots symbolic objects. Also, you need a loop:
syms s
for kc=-2:0.1:1;
t=(-2*kc)/(s^4+3*s^3+4*s^2+3*s+1-2*kc);
ezplot(t);
hold on;
end
In order to plot the step response, you can use the Control System Toolbox:
for kc=-2:0.25:1;
h = tf(-2*kc,[1 3 4 3 1-2*kc]);
step(h,10);
hold on;
end
Upvotes: 1