¿Por qué mi código no corre?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hola, he tratado de correr mi código toda la tarde y solo consigo el error de "not enough input arguments" y un error en la linea de T = T0... y no sé porqué. Necesito ayuda :(
Aquí están el código de la función y el principal
function dxdt = funcionVel(t,x)
M = 1200;
r = 0.25;
c = 20;
T0 = 1000;
t0 = 10;
T = T0*(1 - exp(-t/t0));
dxdt(1) = x(2);
dxdt(2) = T/(M*r) - c*x(2);
dxdt = dxdt';
end
%código principal abajo
clear variables
clc
t = (0:0.1:10);
condInicio = [0;0;0];
[T,Y] = ode45(@funcionVel,t,condInicio);
x1 = Y(:,1);
plot(t,x1)
Antworten (1)
Rafael Hernandez-Walls
am 4 Sep. 2020
Hola, Creo que tu condicion incial debe ser de solo dos elementos y no de tres. Intenta este programa principal, el cual llamará a tu función ya salvada.
clear all
clc
t = 0:0.1:10;
condInicio = [0;0];
[T,Y] = ode45(@funcionVel,t,condInicio);
x1 = Y(:,1);
plot(t,x1)
% Si te sirve mi sugerencia favor de aceptar como respuesta correcta
0 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!