フィルターのクリア

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
Jon
Jon 2023 年 9 月 22 日
This is also detailed in my answer below

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

採用された回答

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 Center および File ExchangePlot Customization についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by