Plot 2D vector field

11 次查看(过去 30 天)
h h
h h 2016-5-4
Hello,
I'm currently modelling ice sheet dynamics. I have a dataset of:
- 20x34 vertical velocities named wi (in meters per year), where positive means upward movement and negative downward
- 20x34 horizontal velocities named ui (in meters per year),
- horizontal coordinates named realxh(:,1:nx-1)/1000
- vertical coordinates named realzh(:,1:nx-1)
However, when I try to plot them I get the following, see below (with this code):
quiver(realxh(:,1:nx-1)/1000, realzh(:,1:nx-1), ui(:,1:nx-1), wi(:,1:nx-1));
It seems that only horizontal vectors are plotted... Besides the density looks a little bit chaotic. Can someone help me please? It would also be nice to plot the streamlines together with it. For those interested, I uploaded the matlab array as an attachment.
  1 个评论
Rohan P
Rohan P 2021-7-10
Draw the two dimensional vector field for the vector −2𝑦𝑖̂+5𝑥𝑗̂.2

请先登录,再进行评论。

回答(1 个)

Scott MacKenzie
Scott MacKenzie 2021-7-10
The reason you aren't seeing any vertical component in the quiver arrows is that the data in the V argument (wi) are very small compared to the y-axis values in the chart. The y-axis values range from 0 to 3000 but the values in the wi vector are between -1 and 2.5. So, you have a vertical component to the arrows, but you can't see it. To demonstate, I multiplied the wi values by 1000:
quiver(realxh(:,1:nx-1)/1000, realzh(:,1:nx-1), ui(:,1:nx-1), wi(:,1:nx-1)*1000); % wi * 1000
Below is a zoomed-in portion of the plot. The arrows clearly have a vertical component.

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by