
Passing parameters to a function used by fminsearch
Posted:
Jan 21, 2008 2:32 AM


I need to solve a nonlinear equation: x^n=(a/b) (1/(c+(d/x)))(1/e)
x is the unknown, all the others(a,b,c,d,n) are parameters, and all scalars.
I wanted to use fminsearch to solve the problem:
x=fminsearch(myFunc,x0,options);
where
function[f]=myFunc(x)
f= (x^n)(a/b) (1/(c+(d/x)))
The values of (a,b,c,d,n) change all the time, so I do not want to hard wire their values into the function definiton. How do I pass their values to myFunc, without the use of globals?

