Borrar filtros
Borrar filtros

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

100 visualizaciones (últimos 30 días)
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 comentarios
Mathieu NOE
Mathieu NOE el 22 de Sept. de 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

Iniciar sesión para comentar.

Respuesta aceptada

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

Más respuestas (1)

Jon
Jon el 22 de Sept. de 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

Categorías

Más información sobre Plot Customization en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by