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

Antworten (1)

Torsten
Torsten am 8 Mär. 2017

0 Stimmen

"strain" must have the same number of elements as "e0". Is this the case for your code ?
Best wishes
Torsten.

Diese Frage ist geschlossen.

Tags

Gefragt:

am 8 Mär. 2017

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by