Retime mean data not aligning

3 ビュー (過去 30 日間)
Oliver Higbee
Oliver Higbee 2021 年 8 月 6 日
コメント済み: Peter Perkins 2021 年 9 月 2 日
Hi there,
I'm using retime on a data set with a one second interval, to obtain averages for days and months (and many other intervals). One of the variables, Cool, in the table is a cooling % calculated from two other table variables, C1 and C2;
T1.Cool = 100*((T1.C1 - T1.C2) ./ T1.C1);
However when I use retime to change the interval of the data e.g.
TDay = retime(T1,"daily","mean");
The values of TDay.Cool is no longer the cooling difference between the new TDay.C1 and C2 variables. I.e. If Tday.C1 =100 and Tday.C2 = 90, Tday.Cooling shows as 9% rather than the actual cooling which is 10%.
What is happening in retime to get such behaviour and how can I correct it?
  5 件のコメント
Oliver Higbee
Oliver Higbee 2021 年 8 月 9 日
Sure, apologies for not starting with this!
Attached are the input and output files (Had to retime to 1minute to get below attachment file size). With just the following code used to get the output;
TDay = retime(T1,'daily','mean'); %Take daily averages
TDay.("Correct Cooling (%)") = 100*((TDay.C1 - TDay.C2) ./ TDay.C1);
Peter Perkins
Peter Perkins 2021 年 9 月 2 日
Oliver, are you computing
mean(100*((T1.C1 - T1.C2) ./ T1.C1))
and expecting that to be the same as
100*((mean(TDay.C1) - mean(TDay.C2)) ./ mean(TDay.C1))
? Those are not the same thing.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by