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
Cris LaPierre 2023 年 4 月 4 日

0 投票

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
Image Analyst 2023 年 4 月 4 日

0 投票

You might look into these functions: groupsummary, grpstats, or splitapply
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 ExchangeTime Series Events についてさらに検索

製品

リリース

R2022b

タグ

質問済み:

2023 年 4 月 4 日

回答済み:

2023 年 4 月 4 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by