MATLAB Answers

I want to find the x and y values of f(x,y) when f(x,y) is a minimum over x = -1:0.001:1 and y = -1:0.001:1.

2 views (last 30 days)
I know how to get min(f). min(x) and min(y) just give -1, not their values when f(x,y) is a minimum. Please help. Thanks

  0 Comments

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 27 Aug 2016
x=-1:0.001:1
y=x
[ii,jj]=ndgrid(x,y]
z=sin(ii)+cos(jj) % Example
[min_val,index]=min(z)
xidx=x(index)
yidx=y(index)

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags

Products