ODE45 giving error
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
I am trying to solve a constitutive equation with ODE45, and I keep getting an error of "must return a column vector". I know that ODE45 must return a column vector, but I don't see where by error is in my code. I believe that is has to do with the heaviside and dirac functions. I would appreciate the help.
function CREEP
E1=5;
E2=10;
eta=5;
sigma0=20;
tspan=[0 100];
u=heaviside(tspan);
v=dirac(tspan);
sigma=(sigma0*u);
sigma_dot=(sigma0*v);
e0=sigma0/E1;
[t,e]=ode45(@creep, tspan, e0);
plot(t,e)
function strain=creep(t,e)
strain=(1/(E1+E2))*(sigma_dot+E2*sigma/eta-E1*E2*e/eta);
end
end
0 个评论
回答(1 个)
Torsten
2017-3-8
0 个投票
"strain" must have the same number of elements as "e0". Is this the case for your code ?
Best wishes
Torsten.
0 个评论
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!