# Plot wind directions and speed of a day with quiver

56 views (last 30 days)
MathMaus on 17 May 2017
Edited: MathMaus on 18 May 2017
I have given two vectors holding 24 hourly values for wind speed and direction.
I would like to use quiver to plot 24 arrows indicating speed and direction graphically.
I failed with my first tries:
clc; % Clear the command window.
close all; % Close all figures
clear all; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
% given vector of windspeeds througout a day (every h)
windspeeds = rand(1,24)
% given vector of wind directions througout a day (every h)
% the direction is noted in degrees ° from nord
winddirections = randi([1 360],1,24)
% create x/y grid 24x24 for one day
[x,y] = meshgrid(1:24,1:24)
% substract 90° to re-align north to the top
u= mod(90 - winddirections, 360)
v= mod(90 - winddirections, 360)
% convert from degrees to fit the x/y matrix
u= cos(u) * pi/180
v= sin(u) * pi/180
% put it on quiver
quiver( cos(u) * pi/180, sin(u) * pi/180, x, y)
Current Result is I do not yet know how to place these 24 arrows and how to calculate u,v to represent the direction at the given position (time of the day). The quiver doc is rather short. Any hints on how I could proceed.

KSSV on 17 May 2017
workspace; % Make sure the workspace panel is showing.
% given vector of windspeeds througout a day (every h)
windspeeds = rand(1,24) ;
% given vector of wind directions througout a day (every h)
% the direction is noted in degrees ° from nord
winddirections = randi([1 360],1,24) ;
% create x/y grid 24x24 for one day
[x,y] = meshgrid(1:24,1:24) ;
% substract 90° to re-align north to the top
u= mod(90 - winddirections, 360) ;
v= mod(90 - winddirections, 360) ;
% convert from degrees to fit the x/y matrix
u= cos(u) * pi/180 ;
v= sin(u) * pi/180 ;
[U,V] = meshgrid(u,v) ;
% put it on quiver
quiver( x,y,U,V)
##### 2 CommentsShowHide 1 older comment
KSSV on 18 May 2017
Mention the input x,y,d,s so that we can check the code.