Plot 2D vector field

11 Ansichten (letzte 30 Tage)
h h
h h am 4 Mai 2016
Beantwortet: Scott MacKenzie am 10 Jul. 2021
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 Kommentar
Rohan P
Rohan P am 10 Jul. 2021
Draw the two dimensional vector field for the vector −2𝑦𝑖̂+5𝑥𝑗̂.2

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Scott MacKenzie
Scott MacKenzie am 10 Jul. 2021
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.

Kategorien

Mehr zu Vector Fields 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!

Translated by