Help with error: "??? Error using ==> minus. Matrix dimensions must agree. Error in ==> odenumjac at 148, Fdiff = Fdel - Fvalue(:,ones(1,ny));"

Hello, I'm trying to use matlab to solve a differential algebraic system of equations (DAE), without luck. I'm trying to follow the hb1dae example but encounter this error message: "??? Error using ==> minus. Matrix dimensions must agree. Error in ==> odenumjac at 148, Fdiff = Fdel - Fvalue(:,ones(1,ny));"
Any advice on how to proceed?

2 件のコメント

Star Strider
Star Strider 2012 年 10 月 10 日
It would probably help if you posted the relevant parts of your code.
Specifically, what are the sizes of Fdel and Fvalue and what is the value of ny?
Colin
Colin 2012 年 10 月 10 日
Thanks for the inquiry.
Fdel, Fvalue, and ny are generated within ODE23t, so I don't know their origin, but the debugger gives these values for them:
ny:2
Fvalue(:,ones(1,ny)): 0.1992 0.1992 -1.0000 -1.0000
Fdel: 0.1992 -1.0000
Here's a simplified version of my script:
Caller:
M = eye(3,3); M(3,3)=0; y0 = [1 1 0]; tspan = [0.99 0.5]; options = odeset('Mass',M,'MassSingular','yes','RelTol',1e-4,'AbsTol',[1e-6 1e-6 1e-6],'Vectorized','on'); [t,y] = ode23t(@batch_DAE_model,tspan,y0,options);
System of Eqs:
function dy = batch_DAE_model(F,y) DSi=1.2; DAl=0.8; dy = [ ((DSi - 1)/(DSi - F*(DSi - 1))^2); ((DAl - 1)/(DAl - F*(DAl - 1))^2); y(1)+y(2)-2];

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2012 年 10 月 10 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by