Plot 2D vector field

조회 수: 11 (최근 30일)
h h
h h 2016년 5월 4일
답변: Scott MacKenzie 2021년 7월 10일
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