Find the X,Y coordinates for a specific value
38 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162788/image.jpeg)
0 Kommentare
Antworten (1)
Star Strider
am 9 Apr. 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 Kommentare
Star Strider
am 9 Apr. 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.
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!