Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个8760x1带有 1 小时平均环境温度时间序列的向量。
8760x1
我想计算加权平均温度,按每个温度级别的运行时间百分比加权。
我的想法是将温度范围划分为:
ceil(Tmax-Tmin)
然后使用hist.
hist
还有其他建议吗?先感谢您。
假设您有两个长度相同的向量,一个是温度 (temp),另一个是该温度下的时间量 (time_at_temp)。加权平均公式是这样的:
wt_avg_temp = sum(temp .* time_at_temp) / sum(time_at_temp);
mean(temperatures)应该这样做。
mean(temperatures)
由于您有每小时测量值,因此给定值的频率将反映该温度水平下的运行时间。因此,频繁出现的值将自动在平均值中具有更大的权重。