我试图得到三个向量的平均值,但平均函数不起作用。
示例:
A = [1 2 3 4 5];
B = [2 3 4 5 6];
C = [3 4 5 6 7];
V = mean(A,B,C); % should be [2 3 4 5 6] as each column is the some of the same column in A, B and C divided by three.
任何帮助?
答案 0 :(得分:0)
对于一般情况(行或列向量的情况),您可以使用此 -
mean_vals = mean(cat(2,A(:),B(:),C(:)),2)