can anyone help me to get rid of the error not enough input arguments in line 7?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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;
0 comentarios
Respuesta aceptada
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)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!