ODE45 ERROR en el @odefun
显示 更早的评论
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 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!