Calculation of diurnal cycle

10 ビュー (過去 30 日間)
Daphne PARLIARI
Daphne PARLIARI 2020 年 1 月 28 日
コメント済み: Star Strider 2020 年 1 月 30 日
Hi everyone!
I have some .csv files (attached you can see one of them) containing hourly values of temperature and humidity from 1/7/2019 to 30/9/2019. Frome these values I want to extract the diurnal cycle of temperature and humidity, which means 1 mean value for all dates at 00:00, one for 01:00, till 23:00.
What is the most efficient way to do so?
Thank you in advance!
  2 件のコメント
darova
darova 2020 年 1 月 28 日
What about mean function? Did you try it?
Daphne PARLIARI
Daphne PARLIARI 2020 年 1 月 29 日
Sure but I want to take the mean considering the hours, that's what I am not sure how to achieve...

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2020 年 1 月 29 日
Try this:
D = readtable('Airport.csv');
Hrs = hour(D.Date); % Hours
[UHr,~,ic] = unique(Hrs); % Hours Reference Index Vector
TRH = accumarray(ic, (1:numel(Hrs)).', [], @(x){mean([D.Temp(x),D.RelHum(x)])}); % Means By Hour
TRHmtx = cell2mat(TRH); % Matrix From Cell Array: [Temp RelHum]
figure
yyaxis left
plot(UHr, TRHmtx(:,1))
ylabel('Temperature (°C)')
yyaxis right
plot(UHr, TRHmtx(:,2))
ylabel('Relative Humidity (%)')
grid
xlabel('Time (Hours)')
set(gca, 'Xtick',(0:23))
xlim([0 23])
producing:
1Calculation of diurnal cycle - 2020 01 28.png
  2 件のコメント
Daphne PARLIARI
Daphne PARLIARI 2020 年 1 月 30 日
Thank you!!!
Star Strider
Star Strider 2020 年 1 月 30 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSensors and Transducers についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by