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

回答 (1 件)

Torsten
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.

この質問は閉じられています。

タグ

質問済み:

2017 年 3 月 8 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by