Time series with quiver

10 visualizzazioni (ultimi 30 giorni)
Meghan Rochford
Meghan Rochford il 20 Apr 2017
Risposto: Star Strider il 21 Apr 2017
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 Commento
Rik
Rik il 21 Apr 2017
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).

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 21 Apr 2017
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

Più risposte (0)

Categorie

Scopri di più su Vector Fields in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by