Evaluate external function for Couple ODE's

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

Evaluate external function for Couple ODE's

This post was updated on .
First of all, sorry if this is a silly question. I am getting practice in Scilab

I have a set of 8 coupled ODEs and a set of 28 "external equations".

One example of external equation is my volumetric flow rate:

function v=F18(FE,FY,FH,FM,FP,FA,FL,FB,P,T)
    v=(v0*ro0)/F17()
endfunction;

F17 is my density, which is depends on T, Pressure and total molar flow rate, and so on...

When I solve the coupled ODEs as: X=ode(Y0,L0,L,Y), where Y are my coupled ODEs vector, I get the values  for the variables of each differential equation.

My question is, how can I evaluate also the external functions?

I tried 'feval', but without success

Code: F5.sce

Thank you!
Tim Wescott Tim Wescott
Reply | Threaded
Open this post in threaded view
|

Re: Evaluate external function for Couple ODE's

If your L and X vectors are what I think they are, and if your external
equations are what I think they are, then wouldn't each one's output
depend only on the value of one column of X and the corresponding value
of L?

So, vectorize them and call (e.g.) F18(X, L), or F18(X(:, 42), L(42)).

On Tue, 2017-05-02 at 20:21 -0700, tiagorleite wrote:

> First of all, sorry if this is a silly question. I am getting
> practice in
> Scilab
>
> I have a set of 8 coupled ODEs and a set of 28 "external equations".
>
> One example of external equation is my volumetric flow rate:
>
> function v=F18(FE,FY,FH,FM,FP,FA,FL,FB,P,T)
>     v=(v0*ro0)/F17()
> endfunction;
>
> F17 is my density, which is depends on T, Pressure and total molar
> flow
> rate, and so on...
>
> When I solve the coupled ODEs as: X=ode(Y0,L0,L,Y), where Y are my
> coupled
> ODEs vector, I get the values  for the variables of each differential
> equation.
>
> My question is, how can I evaluate also the external functions?
>
> I tried 'feval', but without success
>
> Thank you!
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/Evaluate
> -external-function-for-Couple-ODE-s-tp4036287.html
> Sent from the Scilab users - Mailing Lists Archives mailing list
> archive at Nabble.com.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>
>
--

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
tiagorleite tiagorleite
Reply | Threaded
Open this post in threaded view
|

Re: Evaluate external function for Couple ODE's

Tim,

Thanks for your response.

X is my ODE solution vector for molar flow rates (Fi's), pressure (P) and temperature (T). L is my integration range. I don't know if you had a chance to check, but I have the code uploaded.

I will try your suggestion.

to evaluate the external function, would you use feval(X,L,F17)?

Thanks again!
Tim Wescott Tim Wescott
Reply | Threaded
Open this post in threaded view
|

Re: Evaluate external function for Couple ODE's

Read the help for feval.  It appears that feval(X, L, F17) would give
you a honkin' big square matrix of answers that are only valid along
the diagonal.  I think you just need to write a version of F17 that
understands getting X as a matrix and L as a vector.  If you've been
handed F17, you may need to write your own version of feval that loops
through the columns of X and values of L to give you a vector of
answers.

On Wed, 2017-05-03 at 10:43 -0700, tiagorleite wrote:

> Tim,
>
> Thanks for your response.
>
> X is my ODE solution vector for molar flow rates (Fi's), pressure (P)
> and
> temperature (T). L is my integration range. I don't know if you had a
> chance
> to check, but I have the code uploaded.
>
> I will try your suggestion.
>
> to evaluate the external function, would you use feval(X,L,F17)?
>
> Thanks again!
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/Evaluate
> -external-function-for-Couple-ODE-s-tp4036287p4036296.html
> Sent from the Scilab users - Mailing Lists Archives mailing list
> archive at Nabble.com.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>
>
--

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users