From: Chris Burt on
I'm creating a function that requires a mathematical function as an input argument(i.e. not a matlab function). I want to input f(x,y) and then the matlab function will calculate certain things relating to f(x,y). How can I make it so that f(x,y) is recognised as a function of x and y instead of a matrix?
Cheers.
From: Sean on
"Chris Burt" <chrisburt555(a)gmail.com> wrote in message <i3ek6g$40l$1(a)fred.mathworks.com>...
> I'm creating a function that requires a mathematical function as an input argument(i.e. not a matlab function). I want to input f(x,y) and then the matlab function will calculate certain things relating to f(x,y). How can I make it so that f(x,y) is recognised as a function of x and y instead of a matrix?
> Cheers

hint:
doc function_handle
From: Andy on
"Chris Burt" <chrisburt555(a)gmail.com> wrote in message <i3ek6g$40l$1(a)fred.mathworks.com>...
> I'm creating a function that requires a mathematical function as an input argument(i.e. not a matlab function). I want to input f(x,y) and then the matlab function will calculate certain things relating to f(x,y). How can I make it so that f(x,y) is recognised as a function of x and y instead of a matrix?
> Cheers.

It's unclear what you mean by "a mathematical function...not a matlab function". If you mean a custom made function, you should pass the function handle. If you mean a word which your function should recognize as the name of a mathematical function (which your function will then implement or process in some way), then you should probably pass the name of the function as a string.
From: Walter Roberson on
Chris Burt wrote:
> I'm creating a function that requires a mathematical function as an
> input argument(i.e. not a matlab function). I want to input f(x,y) and
> then the matlab function will calculate certain things relating to
> f(x,y). How can I make it so that f(x,y) is recognised as a function of
> x and y instead of a matrix?

If you need to do things like differentiate or calculate degrees, and
your function cannot be expressed as a ratio of multinomials with
integer or floating point coefficients, then you are probably need to
use a symbolic representation such as by using the symbolic toolbox.
From: Chris Burt on
"Chris Burt" <chrisburt555(a)gmail.com> wrote in message <i3ek6g$40l$1(a)fred.mathworks.com>...
> I'm creating a function that requires a mathematical function as an input argument(i.e. not a matlab function). I want to input f(x,y) and then the matlab function will calculate certain things relating to f(x,y). How can I make it so that f(x,y) is recognised as a function of x and y instead of a matrix?
> Cheers.
Thanks for the suggestions, I've sorted it using inline(f,x,y), turns out it wasn't a very complicated problem, I just didn't explain it very well!