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 件のコメント

Arnaud Miege
Arnaud Miege 2011 年 6 月 20 日
Why would you want to see something that goes to infinity?
sadel
sadel 2011 年 6 月 20 日
because my program is an educational tool for continuous and discrete systems and I want to represent the responses of any system on axes.
sadel
sadel 2011 年 6 月 20 日
Any idea?
Fangjun Jiang
Fangjun Jiang 2011 年 6 月 20 日
Let me ask you this, this is a simple transfer function, what is the step response if you solve it on paper? In other word, what is the theoretical answer?
sadel
sadel 2011 年 6 月 20 日
Maybe this is a continuous incremental vibration.
Arnaud Miege
Arnaud Miege 2011 年 6 月 20 日
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
Fangjun Jiang 2011 年 6 月 20 日
@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.

サインインしてコメントする。

 採用された回答

Paulo Silva
Paulo Silva 2011 年 6 月 20 日

1 投票

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 件のコメント

Fangjun Jiang
Fangjun Jiang 2011 年 6 月 20 日
I don't understand, Paulo. He asks for the step response of a transfer function. s is not a variable, it is the symbol of Laplace transform.
Paulo Silva
Paulo Silva 2011 年 6 月 20 日
I know what s is but given the expression you can plot it, also your answer below is correct, the symplified expression is s^2+1 thus the graph you get with my code.
Fangjun Jiang
Fangjun Jiang 2011 年 6 月 20 日
So your graph represents the function y=f(x)=x*x+1. sadel is asking for the step response of the transfer function H(s)=s^2+1. I think your answer is misleading and kind of mudding the water.
Paulo Silva
Paulo Silva 2011 年 6 月 20 日
Fangjun Jiang you are half right, actually my code does the impulse response H(s)*1, the step response is H(s)*1/s , it just adds another pole to the transfer function:
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])
Fangjun Jiang
Fangjun Jiang 2011 年 6 月 20 日
@Paulo, I am kind of lost. Let's use a proper transfer function H(s)=1/(s+1) as an example. step(tf(1,[1 1])) give the step response (in time domain). How do you use the Symbolic Math Toolbox to plot out its step response? Your code plotted the mathematical function of num/den treating s as the variable in the x-axle. It is not an impulse response or a step response. You do have control theory background, don't you?
Paulo Silva
Paulo Silva 2011 年 6 月 20 日
Yes I have control theory background, here's your H(s)=1/(s+1) , with and without using the step function:
syms s t
TFC=evalc('tf([1 1],[1 1 1 0])');
subplot(211)
[a b] = strread(TFC, '%s %s', 'delimiter',char(10));
num=sym(char(a(2)));
den=sym(char(a(3)));
tft=ilaplace(num/den);
tt=0:0.01:10;
plot(tt,subs(tft,t,tt))
title('Paulo Silva step vs Ctr. Toolbox step')
ylabel('Amplitude')
xlabel('time')
grid on
subplot(212)
step(tf([1 1],[1 1 1]))
Paulo Silva
Paulo Silva 2011 年 6 月 20 日
The code I provided for H(s)=1/(s+1) just works properly for proper systems (less zeros than poles)
Fangjun Jiang
Fangjun Jiang 2011 年 6 月 21 日
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
Paulo Silva 2011 年 6 月 21 日
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" :)

サインインしてコメントする。

その他の回答 (4 件)

Fangjun Jiang
Fangjun Jiang 2011 年 6 月 20 日

1 投票

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.
sadel
sadel 2011 年 6 月 20 日

0 投票

Let's say that we have this system in open loop.
sys=tf([1 1 1 1 1 1],[1]);
I receive the same error because it is unstable. more zeros than poles etc.
If I use the closed loop of this system, I can receive a graph. But why? It's unstable, too.
sys=tf([1 1 1 1 1 1],[1 1 1 1 1 2]);
t=0:0.01:30;
step(sys,t)
I wanna say that I want a graph for the open loop system but only for 30 seconds. I don't care if this goes to infinity. How can I fool the matlab about the number of the zeros and poles? p.s. I agree with Fangjun. Paulo, 1/(s+a)=exp(-a*t). It's not the same graph.

1 件のコメント

Paulo Silva
Paulo Silva 2011 年 6 月 20 日
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
Alberto 2013 年 10 月 21 日

0 投票

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
Gauri Shankar Prasad
Gauri Shankar Prasad 2018 年 5 月 5 日

0 投票

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??

質問済み:

2011 年 6 月 20 日

回答済み:

2018 年 5 月 5 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by