Time series with quiver

10 views (last 30 days)
Meghan Rochford
Meghan Rochford on 20 Apr 2017
Answered: Star Strider on 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 Comment
Rik
Rik on 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).

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 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

More Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!