help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lsode use


From: Céline
Subject: Re: lsode use
Date: Wed, 26 Aug 2015 01:36:31 -0700 (PDT)

In fact, my J values are different at each time t and are calculated
separately at each time.
So I need, each time, to give my J value to my ODE to be able to resolve
it...

I've tried your advices, but I do probably something wrong since it does not
work at all...

Here is the code of the loop (I've all the initialization of parameters and
variables before this):

for t=0:step:ts
     x=@(X0,J) humsolide(X0,t,J);
    [X, ISTATE, MSG]=lsode(x,X0,temps);
    psat=psat0*exp(-(Lm/Rg)*((1/T)-(1/T0)));
    if X(i)>=Xc
      %evaporation rate calculation
      J=a*Mw*ke*((psat/(Rg*T))-(p/(Rg*T))*(Y/((Mw/Ma)+Y)));
    elseif X(i)<=Xc
      %parameters calculation
      Ri=R*(((X-Xr)/(Xc-Xr))^(1/3));
      ki=((eps*D)/(tau*((R)^2)))*(1/((1/Ri)-(1/R)));
      %evaporation rate calculation
      J=a*Mw*(1/((1/ke)+(1/ki)))*((psat/(Rg*T))-(p/(Rg*T))*(Y/((Mw/Ma)+Y))); 
  end
  Y=((Ms*J)/G)+Y0;
  T=T0-((Ms*J*Lk)/(cpa*G));
  %Adding the results in "results matrix"
  Yres=[Yres;Y];
  Jres=[Jres;J];
  i+=1;
end

And my function humsolide:

function XDOT=humsolide(X0,t,J)
  XDOT=-J;
  endfunction

Do you know what's wrong ?



--
View this message in context: 
http://octave.1599824.n4.nabble.com/lsode-solver-problem-tp4672270p4672289.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]