Error with a odea nonconformant arguments

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error with a odea nonconformant arguments

sergioh99
I'm trying to solve a ode with a ode45 function but when i run the code i see
the nonconformant arguments error, how can i fix this? Thanks

i=floor(t/dt)+1;
if i<n
a=(hm(i+1)-hm(i))/dt;
b=(hm(i)-a*tiempo(i));
else
a=(hm(i)-hm(i-1))/dt;
b=(hm(i-1)-a*tiempo(i-1));
end
Hm=a*t+b;
dTmdt=(((1-nm)*W)/mm/cpm)-((Hm*Am*(Tm-Tamb))/mm/cpm);
end

Error: starting_stepsize: operator /: nonconformant arguments (op1 is 1x1,
op2 is 0x0)
error: called from
    starting_stepsize at line 55 column 8
    ode45 at line 192 column 25





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Error with a odea nonconformant arguments

Colin Macdonald-2
On 2019-05-10 10:47 p.m., sergioh99 wrote:
> I'm trying to solve a ode with a ode45 function but when i run the code i see
> the nonconformant arguments error, how can i fix this? Thanks

I didn't look at your code but the first thing I'd check is whether your
RHS function is vectorized.  Or play with "odeset" (the "vectorized"
option).

Colin