How to plot only negative values in a WindRose?
Show older comments
I'm working with a function called WindRose.m from Daniel Pereira. https://de.mathworks.com/matlabcentral/fileexchange/47248-wind-rose I'm trying to plot values of atmospheric temperature stability, which can be also negative. I manage to plot all data together and also only the positive values, but I getting an error when I want to plot only the negatives values. And I don't understand what and where I must change the function to get the right plot.
First I tried to modify the signal directly from the function codes here:
speed = speed(speed<0);
When I run the whole code:
% directions
dir=WR;
% speeds
spd=sigma_theta; %specify with values on WindRose.m!
% Positions
Options = {'anglenorth',0,'angleeast',90,'labels',{'N','S','E','W'},'nFreq',5,'FreqLabelAngle',45,'nSpeeds',6,'Min_Radius',0,'TitleString',{'Temp.Stability - Wind rose';''},'LabLegend','Temperatur Stability','LegendVariable','{\sigma\theta}'};
% Windrose plot
[figure_handle,count, speeds, directions]= WindRose(dir,spd,Options);
appears:
Index exceeds matrix dimensions.
Error in WindRose>PivotTableCount (line 383)
counter = histc(speed(cond),[vwinds(:)' Inf]); %# ADDED 2015/Jun/22: Consider the wind speeds greater
than max(vwinds), by adding inf into the histogram count
Error in WindRose (line 304)
count = PivotTableCount(N,n,vwinds,speed,dir,NumberElements); % For each direction and for each speed, value of the
radius that the windorose must reach (Accumulated in speed).
On the second time, I restrict the number of the plot to only my negative values:
i=0;
for j = 1:52705
if sigma_theta(j)<=0
i=i+1;
sigma_theta_copia(i)=sigma_theta(j);
dir_copia(i)= dir(j);
indice(i)=i;
end
end
spd=sigma_theta_copia;
dir2=dir_copia;
% Positions
Options2 = {'anglenorth',0,'angleeast',90,'labels',{'N','S','E','W'},'nFreq',5,'FreqLabelAngle',45,'nSpeeds',6,'Min_Radius',0,'TitleString',{'Temp.Instability - Wind rose';''},'LabLegend','Temperatur Instability','LegendVariable','{\sigma\theta}'};
% Windrose plot
[figure_handle,countn, speedsn, directionsn]= WindRose(dir2,spd,Options2);
But, again I got Erros:
Error using xlim (line 31)
Limits must be a 2-element vector of increasing numeric values.
Error in WindRose (line 349)
xlim(axs,[-radiusmax radiusmax]/scalefactor); % Set limits
Unfortunately I cannot show the data that I using.
Accepted Answer
More Answers (0)
Categories
Find more on Geographic Plots 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!