Plot 2D vector field
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!