Borrar filtros
Borrar filtros

can anyone help me to get rid of the error not enough input arguments in line 7?

2 visualizaciones (últimos 30 días)
m = 2;
c = 0.4;
k = 4;
x0 = [10; 0];
Time_Span = [0, 40.0];
xdot = zeros(2,1);
xdot(1) = x(2);
xdot(2) = -(1/m)*(c*x(2) + k*x(1));
[t_ex2, x_ex2] = ode45(@ODE_Damped_Spring, Time_Span, x0);
figure;
plot(t_ex2, x_ex2(:,1), 'o-')
title('ode45 Position for Damped Spring')
grid on;

Respuesta aceptada

Torsten
Torsten el 18 de En. de 2024
x0 = [10; 0];
Time_Span = [0, 40.0];
[t_ex2, x_ex2] = ode45(@ODE_Damped_Spring, Time_Span, x0);
figure;
plot(t_ex2, x_ex2(:,1), 'o-')
title('ode45 Position for Damped Spring')
grid on
function xdot = ODE_Damped_Spring(t,x)
m = 2;
c = 0.4;
k = 4;
xdot = zeros(2,1);
xdot(1) = x(2);
xdot(2) = -(1/m)*(c*x(2) + k*x(1));
end

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by