fminsearch with 3 variables

2 views (last 30 days)
Hello,
How do I use fminsearch for a equation with 3 variables?
f(x,y,z)=1-(x-1)^(2) * (y-1.7)^(2) - (y-1.5)^(2) * (z-2.1)^2
I thought something like this :
fun=@(x,y,z) 1-(x-1).^(2).*(y-1.7)^(2)-(y-1.5)^(2)*(z-2.1).^2
fminsearch(fun,[0,0,3]) (with (0,0,3) a random point)
but I always got the message "Not enough input arguments"
Thanks in advance!

Accepted Answer

Walter Roberson
Walter Roberson on 28 Feb 2021
example
f=@(v)v(1).*v(2)-sin(v(1)+v(2))
Instead of
f=@(x,y)x.*y-sin(x+y)

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!