How can I fix this error?
29 views (last 30 days)
Show older comments
Hi all!
How can I fix this error?
sys=tf([1 1 1 1],[1 1]);
t=0:0.1:10;
step(sys,t)
??? Error using ==> DynamicSystem.step at 84 Cannot simulate the time response of models with more zeros than poles.
I know that my system is unstable but how can I receive an "unstable" graph for this system on my axes?
7 Comments
Arnaud Miege
on 20 Jun 2011
You can't have systems that are not proper (order of numerator -> order of denumerator) in the control system toolbox. Paulo's suggestion with the symbolic math toolbox is about as good as it gets.
Fangjun Jiang
on 20 Jun 2011
@Arnaud, Can the Symbolic Math Toolbox be used to define a proper transfer function and plot out its step response? I used Maple long time ago and remember it can be done.
Accepted Answer
Paulo Silva
on 20 Jun 2011
Just FYI the following code won't provide the same graph has the step function, it just plots the function having s as the variable, the step fuction just works for proper systems (n poles >= n zeros).
"Impulse response":
syms s
TFC=evalc('tf([1 1 1 1],[1 1])');
[a b] = strread(TFC, '%s %s', 'delimiter',char(10));
num=sym(char(a(2)));
den=sym(char(a(3)));
ezplot(num/den,[0 100])
"Step response":
syms s
TFC=evalc('tf([1 1 1 1],[1 1 0])');
[a b] = strread(TFC, '%s %s', 'delimiter',char(10));
num=sym(char(a(2)));
den=sym(char(a(3)));
ezplot(num/den,[0 100])
The scales aren't the same like you get with the step function.
9 Comments
Fangjun Jiang
on 21 Jun 2011
Now that is the step response! You are taking the transfer function symbolic equation, doing an inverse Laplace transform to get the transfer function in time domain and then get the response in time domain.
Don't take my question and comment as offense. I am just trying to make sure that we are speaking the same language. You got to admit though, that the code in your answer (not the one in the comment) is not plotting the step response or impulse response, whether or not it is a proper or non-proper system.
Paulo Silva
on 21 Jun 2011
Yes I admit my mistake, it wasn't the first time I made mistakes because sadel or other similar person wants to do strange things, fixing MATLAB "errors" :)
More Answers (4)
Fangjun Jiang
on 20 Jun 2011
Your transfer function can be simplified as s^2+1. If your transfer function is 1, then its step response is the step input itself. If your transfer function is s, it means the derivative of the input. The step response would be infinite (impulse) at the time of the step and zero at the rest. If your transfer function is s^2, it means the derivative of the derivative of the input. The step responsive would be impulse and negative impulse at the time of the step and zero at the rest.
0 Comments
sadel
on 20 Jun 2011
1 Comment
Paulo Silva
on 20 Jun 2011
I never said it was the same graph, I tried to help the best I could, please read what I said in the first answer:
The scales aren't the same like you get with the step function.
In your code just rethrow the error to an errordlg or to the command line when the step function returns errors.
Your example:
sys=tf([1 1 1 1 1 1],[1 1 1 1 1 2]);
t=0:0.01:30;
step(sys,t)
has the same number of zeros and poles, MATLAB just detects if the number of zeros is bigger than poles not if the system is unstable, the stability is related to the position of the poles.
Alberto
on 21 Oct 2013
one way to achieve this is to add two poles very far from 0. For example, you can add (s+400) two times, like this:
sys=((400*400)*((s^3)+(s^2)+s+1))/((s+1)*(s+400)*(s*400));
from control theory, these poles are not dominant and don't affect the step response.
bye
0 Comments
Gauri Shankar Prasad
on 5 May 2018
k_dc = 5; Tc = 10; u = 2;
s = tf('s'); sys = k_dc/(Tc*s+1)
step(u*sys)
MATLAB shows
Error using DynamicSystem/step (line 95) Too many input arguments.
Error in Untitled3 (line 8) step(u*sys)
What is the problem??
0 Comments
See Also
Categories
Find more on Control System Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!