Plot multiple irradiances as one average
古いコメントを表示
I am plotting the hourly irradiances of every month, but now I need to plot the hourly average irradiance over the month. I don't know how to do it - I'm very new to MATLAB. Any help would be appreciated :)

回答 (2 件)
Cris LaPierre
2023 年 4 月 4 日
You haven't shared your data, which will impact how this can be done, but I suggest looking into groupsummary. In particular, if your time data in a datetime, you can set the groupbin option to 'month' and your method to 'mean', which will create an output table with the hourly average of the indicated 'datavars' table variables.
Perhaps it would look something like this. Untested, so just for show.
data = readtable(...)
data.Date = datetime(data.YEAR,data.MO,data.DY,data.HOUR,zeros(heigh(data),1),zeros(height(data),1));
Mavg_data = groupsummary(data,"Date","month","mean","irradiance")
plot(Mavg_data.month_data,Mavg_data.mean_irradiance)
Image Analyst
2023 年 4 月 4 日
0 投票
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
カテゴリ
ヘルプ センター および File Exchange で Time Series Events についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!