How to find min/max points on a surface inside a given area
Mostra commenti meno recenti
Hello!
I'e been sitting with this for hours and I need to find the highest and lowest point inside the given triangle and I cannot find any way to do this.
I suspect the highest point is in the upper left corner and the lowest point is lower centre and a bit to the left but how do I get the exact nubers?
And how can I plot the surface in only the triangle?
Very thankful for any answers :)
clf,clear,clc
y=linspace(-3, 1);
x=linspace(0,6);
[X,Y]=meshgrid(x,y);
Z=-9.*X.*Y-12.*X+27.*Y;
contourf(x,y,Z, 50);
hold on
% This is just to show the triangle
% Corners on (3,-3)(6,-2)(0,1)
a=[1 -3]; b=[0 3]; plot(b,a, 'k')
c=[3 6]; d=[-3 -2]; plot(c,d, 'k')
e=[6 0]; f=[-2 1]; plot(e,f, 'k')
1 Commento
Fifteen12
il 8 Feb 2023
This seems like more of a mathematics question than a MATLAB question, but I'll take a stab at it. You've given the elevation as Z = -9 .* X. * Y - 12 .* X + 27 .* Y. If you know the elevation everywhere, you can solve this using general optimization methods. I'm no expert on optimization, but I know outside a convenient analytical solution, normally a restricted boundary optimization problem is best solved numerically. How you do this is up to you-you can develop your own bisection method to converge to the solution, or you might can use the MATLAB Optimization toolbox. You'll likely want to use the linear programming toolbox: https://www.mathworks.com/help/optim/ug/linprog.html
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Calculus in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


