Time series with quiver
조회 수: 10 (최근 30일)
이전 댓글 표시
Hello all
I'm trying to plot a time series of wind speed and direction using quiver but I can't figure it out. I thought it would be pretty logical but quiver requires (x,y) and I don't have that. My data is from the same wind station over a 40 year period. How would I go about plotting the data as a time series?
댓글 수: 1
Rik
2017년 4월 21일
Why do you want to use quivers? Wouldn't two plots with speed and direction separately be more informative?
Otherwise you can still use quiver, but you will have to build it up yourself (start out with regular spaced x values and generate end points based on speed and direction).
채택된 답변
Star Strider
2017년 4월 21일
See if this does what you want:
N = 10;
wind_vel = rand(N, 1)*25; % Velocitoy Vector
wind_dir = randi(360, N, 1); % Direction Vector
wind_u = cos(wind_dir).*wind_vel; % Wind ‘x’ Direction
wind_v = sin(wind_dir).*wind_vel; % Wind ‘y’ Direction
wind_w = zeros(N, 1); % Wind ‘z’ Direction
x = zeros(N, 1); % Station Remains Stationary
y = zeros(N, 1); % Station Remains Stationary
t = linspace(0, 25, N)'; % Time
figure(1)
quiver3(x, y, t, wind_u, wind_v, wind_w)
hold on
plot3(x, y, t, '-k', 'LineWidth',2)
hold off
grid on
댓글 수: 0
추가 답변 (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!