How to plot quiver vectors of same length and plot streamlines?

조회 수: 10 (최근 30일)
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2024년 3월 19일
댓글: Yoni Verhaegen -WE-1718- 2024년 3월 20일
Hi all
I have a velocity field from a glacier (horizontal: ui, and vertical: wi). I can plot it with the code below. How can I
(1) make sure that all quiver arrows are of equal length?
(2) transform these data into streamlines with arrows pointing the direction?
Thanks!
(see attachment for files)
realxh=load('realxh_data.mat').realxh;
realzh=load('realzh_data.mat').realzh;
ui=load('ui_data.mat').ui;
wi=load('wi_data.mat').wi;
nx=34;
figure(1);
quiver(realxh(:,1:nx-1)/1000, realzh(:,1:nx-1), ui(:,1:nx-1), wi(:,1:nx-1));
title('Temperature distribution (°C)');
xlabel('x [km]');
ylabel('Surface elevation [m]');
axis([-10 330 -10 2600])
  댓글 수: 4
Cris LaPierre
Cris LaPierre 2024년 3월 20일
That produces an indexing error (see above).
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2024년 3월 20일
@Cris LaPierre You are right, it should be changed to 34, sorry.

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
Steven Lord 2024년 3월 20일
For part 1, you probably want to normalize your U and V data (if you assemble them into a matrix, the vecnorm function may be of use) then call quiver with the scale input argument being either 'off' or 0.
For part 2, use the X, Y, U, and V data from your quiver call in a similar call to streamline (after turning hold on, of course)?

카테고리

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