Undefined operator '*' for input arguments of type 'struct'.
古いコメントを表示
I need to call an ode15s to solve the system of odes described below but I keep getting this error for line 25 (vec(10)) and I can't find any documentation that can help me...
M, AU, a and No are all (1x1) constants.
Any help is welcome and thanks in advance
function [Lt,vec]=reformerdaes(Lt,x,M,AU,a,No)
yo=[0.015064 0.408652 0.024897 0.437598 0.090726 0 0.023063];
for i = 1:7
y(i)=[x(i+6)];
end
srr=@srreaction;
r=srr(x(7),y,x(2));
h=@enthalpy1;
Hi=h(y,x(2));
Ho=h(yo,x(1));
vec(1)=M*(-r(1)); % CH4
vec(2)=M*(-r(1)-r(2)); % H2O
vec(3)=M*(r(1)-r(2)); % CO
vec(4)=M*(3*r(1)+r(2)); % H2
vec(5)=M*r(2); % CO2
vec(6)=AU*(x(1)-x(2));
vec(7)=-vec(4);
vec(8)=x(7)-a*Lt;
vec(9)=x(6)-x(4)*Hi;
vec(10)=x(5)-No*Ho;
end
回答 (1 件)
dpb
2016 年 4 月 2 日
While not your problem, a stylistic note--
for i = 1:7
y(i)=[x(i+6)];
end
should be written in Matlab as
y=x([1:7]+6);
anad it would also be better to have documentation for the "magic number" 6.
...
h=@enthalpy1;
The problem would seem to be in the return the function enthaly1 provides--apparently it is a structure instead of a double although you don't show us enough to know. How does it get its inputs, btw, hopefully they're not global; "there be dragons" from a code reliability standpoint.
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!