How can i plot a quiver plot on top of this to indicate the flow direction. The blue circles are wells and flow is supposed to go downstream.

2 件のコメント

darova
darova 2020 年 4 月 15 日
Can you attach something more? The data, code
Ali Alkoraishi
Ali Alkoraishi 2020 年 4 月 15 日
clc;clear all;close all
% x and y coordinates of well locations and lake points in cm (3.4cm/km)
w1=[5.9,5.6];
w8=[8,7.6];
w17=[11.9,2];
w21=[9.7,5.3];
w27=[4.6,4.6];
w56=[5.9,1.7];
w58=[5.9,1];
w59=[6.7,4.1];
lakepoint1=[4,6.55];
lakepoint2=[5.75,6.9];
lakepoint3=[7.7,7.65];
% Combined coordinates into a single matrix
wells=[w1;w8;w17;w21;w27;w56;w58;w59;lakepoint1;lakepoint2;lakepoint3];
% Converted well locations to metres
scaledwells=wells*0.441176*1000;
%Groundwater table elevations at each well and at 3 points of the lake. (in metres)
gwtablew1=236.07;
gwtablew8=236.65;
gwtablew17=240.37;
gwtablew21=238.13;
gwtablew27=235.96;
gwtablew56=236.66;
gwtablew58=237.70;
gwtablew59=237.90;;
gwtablelake1=234.19;
gwtablelake2=234.19;
gwtablelake3=234.19;
%Combined into single matrix below
gwtable=[gwtablew1;gwtablew8;gwtablew17;gwtablew21;gwtablew27;gwtablew56;gwtablew58;gwtablew59;gwtablelake1;gwtablelake2;gwtablelake3];
%created scatter plot of x and y coordinates of wells and lake points)
scatter(scaledwells(:,1),scaledwells(:,2))
xlabel('m')
ylabel('m')
grid on
hold on
%Trying to produce contours
scaledwellsx=scaledwells(:,1);
scaledwellsy=scaledwells(:,2);
[X,Y] = meshgrid(sort(scaledwellsx), sort(scaledwellsy));
F = scatteredInterpolant(scaledwellsx,scaledwellsy,gwtable);
Z = F(X,Y);
contour_levels = min(Z,[],'all'):0.2:max(Z,[],'all');
contour(X, Y, Z, contour_levels);

サインインしてコメントする。

 採用された回答

Adam Danz
Adam Danz 2020 年 4 月 15 日

0 投票

Follow this demo. If you get stuck, show us what you've got and we can help you get un-stuck.

4 件のコメント

Ali Alkoraishi
Ali Alkoraishi 2020 年 4 月 15 日
I tried that with the above link and wasn't sure how to incorporate this part into the above code.
[U,V] = gradient(Z,0.2,0.2);
hold on
quiver(X,Y,U,V)
hold off
Adam Danz
Adam Danz 2020 年 4 月 15 日
You just need to add it after your controur() function. You don't even need to change the variable names.
Ali Alkoraishi
Ali Alkoraishi 2020 年 4 月 16 日
This is the output I am getting and its uniform and flowing in the wrong directions, thanks
Adam Danz
Adam Danz 2020 年 4 月 16 日
編集済み: Adam Danz 2020 年 4 月 17 日
To create a grid of quiver arrows that flow down hill rather than up hill,
% Grid interp
Xs = linspace(min(scaledwellsx), max(scaledwellsx),20);
Ys = linspace(min(scaledwellsy), max(scaledwellsy),20);
[Xq, Yq] = meshgrid(Xs,Ys);
Vq = F(Xq,Yq);
% Plot quiver grid
% Negate Vq to reverse polarity of vectors
[U,V] = gradient(-Vq);
hold on
h = quiver(Xq,Yq,U,V,2, 'k') % The 2 is a scaling factor
Notice that gradient(-Vq) reverses the direction of the arrows. You could also try gradient(1./Vq) or use quiverRotate() from the file exchange.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeVector Fields についてさらに検索

質問済み:

2020 年 4 月 15 日

編集済み:

2020 年 4 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by