Hi everybody, thank you so much for reading me, i really appreaciate, so i have a little problem, is very simple i think, i want to do an histogram for every months, i have my data in datetime, and i have the wind velocity, but i want to know the frequency of the data for months, but i don't know what i can't
this is my code right now:
clear;clc;numData = xlsread('enerosolar.xlsx','EneDicV')vel = numData(:,1);Dia = numData(:,2);tEnersol=readtable('enerosolar.xlsx','Sheet','EneDicV'); % read into a table object
tEnersol.Properties.VariableNames={'Vel','Dia'}; % assign variable names
yr=2014; % need the proper year
tEnersol.Date=datetime(yr,1,tEnersol.Dia); % and create a date column
tEnersol.Date.Format='dd/MM'; % display date format
hB=bar(tEnersol.Vel); % bar plot in descending order vs ordinal position
hAx=gca; % get axes handle...
xticks(1:7:365) % about all the ticks there's room for...
xticklabels(cellstr(tEnersol.Date(xticks))) % use the date string as tick labels
hAx.XTickLabelRotation=45; % rotate so can have chance to read...
xlabel('Dia del año'), ylabel('Velocidad de viento promedido diaria[m/s]');perc = hline(2.85154314702398,'r', 'Velocidad de viento promedio '); hold onperc = hline(2.85154314702398,'r', '2.85 m/s '); hold on% perc = hline(4,'r', '4-3 m/s'); hold on
% perc = hline(3,'r', '3-1 m/s'); hold on
figure(2)histogram(day(tEnersol.Vel))xlabel('Velocidad de viento promedido diaria[m/s]'), ylabel('Cantidad de días del año TMYV');ax2 = gca;ax2.XTickLabelRotation = 45;savefig('histogram.fig');h = openfig('histogram.fig');y = findobj(h, 'type', 'histogram')figure(4)
Thank you so much for your valious time.
Best!!
Sophia
Best Answer