[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Most elegant way to pass parameters to functions that are used as ha
From: |
Tatsuro MATSUOKA |
Subject: |
Re: Most elegant way to pass parameters to functions that are used as handles? |
Date: |
Thu, 16 Jul 2015 19:45:08 +0900 (JST) |
----- Original Message -----
> From: rocketsound <
> To: help-octave
> Cc:
> Date: 2015/7/16, Thu 19:09
> Subject: Re: Most elegant way to pass parameters to functions that are used
> as handles?
>
>T hank you both for your replies. Indeed, after reading Markus' answer I also
> think that this is the best solution.
>
>
Marus' answer is a famous example of usefulness of anonymous function in both
MATLAB and Octave.
A similar simple example for using parameters in integrand for quad.
***********************
>> f=@(x,a,b)a*x.^2+b
f =
@(x, a, b) a * x .^ 2 + b
>> quad(@(x)f(x,2,3),0,1)
ans = 3.6667
***********************
Tatsuro