Borrar filtros
Borrar filtros

Find the X,Y coordinates for a specific value

37 visualizaciones (últimos 30 días)
Ilias Iord
Ilias Iord el 9 de Abr. de 2017
Comentada: Star Strider el 9 de Abr. de 2017
Hello to all, since it's my first time here!
I have two vectors of co-ordinates (1-n) for X and Y and a surface (S) with n-n corresponding values.
The question is, how can I get the X, Y values for the single minimum value of S.
%calculation of drawdown in confined aquifer
clear
clc
% Parameter and variable values
xabs=3000;
yabs=xabs;
xmin=-xabs;
ymin=-yabs;
x=xmin:50:xabs;
y=ymin:50:yabs;
x1=1500;
y1=600;
x2=700;
y2=1800;
x3=1200;
y3=900;
x4=500;
y4=800;
rw=0.3; %well radius
rinf1=2000; %m radius of influence
rinf2=3000;
rinf3=5000;
rinf4=500;
k=2.58; %m/day
q1=1200; %m3/day
q2=1500;
q3=2000;
q4=500;
a=45; % m (confined aquifer width)
hw=30; %m ( well drawdown depth)
s1=drawdown(xabs,x1,y1,rinf1,k,q1,a);
s2=drawdown(xabs,x2,y2,rinf2,k,q2,a);
s3=drawdown(xabs,x3,y3,rinf3,k,q3,a);
s4=drawdown(xabs,x4,y4,rinf4,k,q4,a);
s=s1+s2+s3+s4;
"Drawdown" is the function that calculates S for the well data. I need the coordinates for the minimum peak.
Thanks a lot guys!

Respuestas (1)

Star Strider
Star Strider el 9 de Abr. de 2017
Since ‘S’ appears to be a matrix and not a function, try this:
[r,c] = min(S);
This returns the row and column indices of the first minimum the function encounters. Since I am not certain what ‘x’ and ‘y’ represent, I will let you assign them with respect to ‘r’ and ‘c’.
  2 comentarios
Ilias Iord
Ilias Iord el 9 de Abr. de 2017
Editada: Ilias Iord el 9 de Abr. de 2017
Thank you Star Strider!
I do not need the indices of the Minimum's location in the "S" matrix, I need the X,Y coordinates (from the meshgrid) on which this minimum is encountered. For example, in the image I uploaded, I need X=1200 & Y=900 (
Star Strider
Star Strider el 9 de Abr. de 2017
My pleasure!
Use the ‘r’ and ‘c’ values to index into your coordinate vectors to find the ‘X’ and ‘Y’ values.
I cannot run your code, so taking a guess, see if this works:
X = x(r);
Y = y(c);
Reverse them if that is not correct.

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by