Function handle of N,x to function of x

I have K, which is a function handle with 2 inputs of N and x. It want to be able to put a value for N into K and get back a function (or function handle) of x.
For example, if K were x/N, I would get x back when I put in N=1, x/2 back when N=2, etc.
How do I do this?

Respuestas (1)

per isakson
per isakson el 22 de En. de 2012
Try this:
x = 16;
K = @(N) x/N;
K(2)
If that is not what you asked for please rephrase your question.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 22 de En. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by