Plot 2D vector field
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Respuestas (1)
Scott MacKenzie
el 10 de Jul. de 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.
0 comentarios
Ver también
Categorías
Más información sobre Vector Fields en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!