필터 지우기
필터 지우기

why am I getting the error "Incorrect number or types of inputs or outputs for function 'step."

조회 수: 100 (최근 30일)
my code is
clear all, close all
m1 = 10;
m2 = 350;
kw = 500000;
ks = 10000;
B = [ 1000 2000 3000 4000 ];
t = 0:0.01:2;
for i = 1:4
b = B(i);
F = [ 0 1 0 0; -( ks/m1 + kw/m1 ) -b/m1 ks/m1 b/m1; 0 0 0 1; ks/m2 b/m2 -ks/m2 -b/m2 ];
G = [ 0; kw/m1; 0; 0 ];
H = [ 1 0 0 0; 0 0 1 0 ];
J = 0;
y = step( F, G, H, J, 1, t );
subplot(2,2,i);
plot(t, y(:,1), ':', t, y(:,2), '-' );
legend('Wheel','Car');
ttl= sprintf('Response with b = %4.1f',b);
title(ttl);
end
and i got
"Incorrect number or types of inputs or outputs for function 'step'."
this message
  댓글 수: 3
Mathieu NOE
Mathieu NOE 2023년 9월 22일
this is ok for older matlab releases
if you use a recent matlab version, please create first the system sys and them call step(sys) as described in the doc :
FYI , in ttachment the "old" step function if you need it

댓글을 달려면 로그인하십시오.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2024년 5월 31일
The "step" function is included in the Control System Toolbox. Please contact sales or reach out to your License Administrator. 

추가 답변 (1개)

Jon
Jon 2023년 9월 22일
This runs for me in R2023b, what version are you running? If I look at the actual step.m file in my directory, which comes up as C:\Program Files\MATLAB\R2023a\toolbox\control\ctrlobsolete\step.m
I see that the calling arguments that you use will no longer be supported. Instead you must make a linear system and pass this to test. Perhaps on your version the call using A,B,C,D matrices is already no longer supported.
% Old help
%warning(['This calling syntax for ' mfilename ' will not be supported in the future.'])
%STEP Step response of continuous-time linear systems.
% STEP(A,B,C,D,IU) plots the time response of the linear system:
% .
% x = Ax + Bu
% y = Cx + Du
m1 = 10;
m2 = 350;
kw = 500000;
ks = 10000;
B = [ 1000 2000 3000 4000 ];
t = 0:0.01:2;
for i = 1:4
b = B(i);
F = [ 0 1 0 0; -( ks/m1 + kw/m1 ) -b/m1 ks/m1 b/m1; 0 0 0 1; ks/m2 b/m2 -ks/m2 -b/m2 ];
G = [ 0; kw/m1; 0; 0 ];
H = [ 1 0 0 0; 0 0 1 0 ];
J = 0;
y = step( F, G, H, J, 1, t );
subplot(2,2,i);
plot(t, y(:,1), ':', t, y(:,2), '-' );
legend('Wheel','Car');
ttl= sprintf('Response with b = %4.1f',b);
title(ttl);
end
In any case I would recommend calling using the current version of step, which is
figure % make new figure
m1 = 10;
m2 = 350;
kw = 500000;
ks = 10000;
B = [ 1000 2000 3000 4000 ];
t = 0:0.01:2;
for i = 1:4
b = B(i);
F = [ 0 1 0 0; -( ks/m1 + kw/m1 ) -b/m1 ks/m1 b/m1; 0 0 0 1; ks/m2 b/m2 -ks/m2 -b/m2 ];
G = [ 0; kw/m1; 0; 0 ];
H = [ 1 0 0 0; 0 0 1 0 ];
J = 0;
sys = ss(F,G,H,J);
y = step( sys,t );
subplot(2,2,i);
plot(t, y(:,1), ':', t, y(:,2), '-' );
legend('Wheel','Car');
ttl= sprintf('Response with b = %4.1f',b);
title(ttl);
end

카테고리

Help CenterFile Exchange에서 Plot Customization에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by