solving DAEs ,errors happen ,i do not know why
显示 更早的评论
code:
function mainsolve
M=[1 0 0 0;
0 1 0 0;
0 0 0 0;
0 0 0 0];
y0=[1;0;1;0];
tspan=[0,1];
options = odeset('Mass',M,'RelTol',1e-4,...
'AbsTol',[1e-6 1e-6 1e-6,1e-6],...
'Vectorized','on');
[t,y] = ode15s(@ct,tspan,y0,options);
plot(t,y);
function dy=ct(r,y)
dy=[-8*y(1)+8*y(3)+0.2*(1-y(2))*exp(20-20/y(1));
-8*y(2)+8*y(4)+0.2*(1-y(2))*exp(20-20/y(1));
-4*y(1)+5*y(3)-0.92;
-4*y(2)+4*y(4)];
errors message:
Error using -
Matrix dimensions must agree.
Error in odenumjac (line 147)
Fdiff = Fdel - Fvalue(:,ones(1,ny));
Error in daeic12 (line 37)
[DfDy,Joptions.fac,nF] = odenumjac(fun, {t0,y,args{:}}, f, Joptions);
Error in ode15s (line 310)
[y,yp,f0,dfdy,nFE,nPD,Jfac] = daeic12(odeFcn,odeArgs,t,ICtype,Mt,y,yp0,f0,...
Error in mainsolve (line 11)
[t,y] = ode15s(@ct,tspan,y0,options);
2 个评论
KSSV
2016-6-15
what is the differential equation you are trying to solve?
Xiao Sidao
2016-6-15
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
