MATLAB Answers

0

Wind rose plot of data?

Asked by Kyle Milke on 5 Jun 2015
Latest activity Answered by Star Strider
on 5 Jun 2015
I have a set of wind data that I have attached. I am trying to create a wind rose plot so I can show the predominant wind direction from that data. I only have the trial version of matlab, and I am also very new to matlab. Could someone please show me a way (give me the codes) to create a wind rose plot for my data? Note: there are two sets of data in the attached file, one set for one day and another for the next day. If it is possible I would also really like to include the average wind speed in the plot too. Once again, I only have the trial version of matlab and therefore do not have any of the toolboxes, so the method has to be compatible with what I have. Thank you!!

  0 Comments

Sign in to comment.

1 Answer

Star Strider
Answer by Star Strider
on 5 Jun 2015
 Accepted Answer

The rose plot will do a histogram with respect to direction. The for loop and subsequent plot will do the velocity-direction histogram, all without toolboxes, since I believe this uses only core MATLAB functions:
[d,s,r] = xlsread('Kyle Milke WindData.xlsx');
Q1 = d(1:5,:); % Data Excerpt (Line May Be Deleted)
figure(1)
rose(d(:,6)*180/pi, [0.5:10:355])
title('Wind Direction (Degrees)')
for k1 = 1:36 % Velocity Histogram Loop
Q2 = [d(:,6)>=(k1-1)*10 & d(:,6)<(k1)*10];
velhist(k1,:) = [(k1)*10 sum(Q2) sum(d(Q2,3)) sum(d(Q2,3))/sum(Q2)];
end
xr = [repmat(velhist(:,4)', 10, 1); zeros(1,36)];
xr = [0 reshape(xr, 1, [])];
th = linspace(0, 359, length(xr));
figure(2)
polar(th*pi/180, xr)
title('Mean Wind Velocity')
The ‘velhist’ matrix contains the angle in the first column, the number of observations in that angle bin in the second, the sum of the average wind velocities in the third, and the computed average of them in the fourth.
I described the function of the code for the ‘rose-version-of-bar’ plot here, so I won’t repeat it.
I believe this takes the data for both days, so if you want data for each, you will need to segregate them by day. (This is easiest using datenum and datevec in that order.)
You may have to experiment with it to get the result you want.

  0 Comments

Sign in to comment.