Filter löschen
Filter löschen

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

100 Ansichten (letzte 30 Tage)
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 Kommentare
Mathieu NOE
Mathieu NOE am 22 Sep. 2023
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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

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

Weitere Antworten (1)

Jon
Jon am 22 Sep. 2023
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

Kategorien

Mehr zu Plot Customization finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by