help-octave
[Top][All Lists]
Advanced

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

Functions and handles


From: Fausto Arinos de A. Barbuto
Subject: Functions and handles
Date: Fri, 6 Jun 2014 10:33:47 -0700 (PDT)


Hello,

Is there a way to turn a function like:
function xdot = f(x,t)
    r = 0.25;
    k = 1.4;
    a = 1.5;
    b = 0.16;
    c = 0.9;
    d = 0.8;
    xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1));
    xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2);     
endfunction

into a function handle? I don't want to pass "r", "k", "a", etc, to the
function as parameters in the function call (e.g. f = @(x,t,r,k,a,b,c,d) );
I want to define them within the handle (suppose that "r", "k", etc might
not be constants but rather functions of "x" and/or "t", e.g. r = x(1)*t^2).

Thanks in advance.

Fausto



reply via email to

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