gpt4 book ai didi

Matlab:4维矩阵中的平均值

转载 作者:太空宇宙 更新时间:2023-11-03 19:48:29 25 4
gpt4 key购买 nike

我在 Matlab 中有一个 4 维矩阵(时间、one_variable、Y_location、X_location)。

这是 4 维矩阵的样子:

>> size (npp_data_pft1)
ans =
100 1 289 570

100 表示 100 个时间步; 1 表示这里只有 1 个变量; 289 和 570 是 y 和 x 网格单元索引。

如何获取特定区域的平均值?

例如,我想在 33 < Y_location < 47 和 112 < X_location < 176 的区域内获取时间步长 1 的平均值。

最佳答案

一种方法是提取您的区域,然后取平均值。

A = npp_data_pft1(1, 1, 33:47, 112:176);
mean(A(:)) % returns scalar value

关于Matlab:4维矩阵中的平均值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18881057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com