ODE45 ERROR en el @odefun
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mauro Gonzalez
am 16 Mär. 2023
Beantwortet: Torsten
am 16 Mär. 2023
Hola!
Estoy utilizando el comando ODE45 para resolver una ecuación diferencial pero me da erro en la función que utilizo para el ODE45,
Me aparecen los siguientes errores, ¿a que se refiere con ''Index exceeds matrix dimensions''?.

clear all
clc
tspan=[0:0.1:10]
CI=[0 0]
[t Y]= ode45(@resode,tspan,CI)
plot(tspan,Y(:,1),'-','b')
hold on
grid on
plot (tspan,Y(:,2),'.','g')
La función es:
function dfidt=resode(t,fi)
delta1 = pi/12*sin(pi*t/3);
delta2 = 0 ;
delta3 = -pi/12* sin((t-4)*0.5*pi);
delta4 = 0 ;
Delta=((t>0)&(t<=3)).*delta1 + ((t>3)&(t<=4)).*delta2 + ((t>4)&(t<=6)).*delta3 + (t>6).*delta4;
Ix=3783.5
Mfip=3481.2
Mfipp=1196
Mdel=1334.2
fi1=fi(1)
fi2=fi(2)
dfi1=fi(2)
dfi2=-Mfip*fi2/(Ix-Mfipp)+Mdel*Delta/(Ix-Mfipp)
dfidt=[dfi1(1);dfi2(2)]
end
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
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!