How do I confront the value of a matrix?

1 回表示 (過去 30 日間)
HelpAStudent
HelpAStudent 2021 年 10 月 11 日
編集済み: DGM 2021 年 10 月 11 日
Hi, I have a matrix 21x6
I have for rows 16:20 confront the column:
for example for the first rows to analyze: (ROW 16)
(Column 4 - Column 1) / 12 = x
(Column 5 - Column 2) / 12 = y
(Column 6 - Column 3) / 12 = z
(x+y+z):3=value16
And after each rows I need the mean of the value printed

採用された回答

DGM
DGM 2021 年 10 月 11 日
編集済み: DGM 2021 年 10 月 11 日
I'm not really sure what this is supposed to mean.
%(x+y+z):3=value16
What guarantees that the sum of x,y,z is less than 3?
I guess you can start with this:
% test array
A = randi(9,21,6)
% get all xyz, sum
xyz = sum((A(16:20,4:6) - A(16:20,1:3))/12,2)
% expand and take mean
mn = zeros(size(xyz));
for r = 1:size(xyz,1)
mn(r) = mean(xyz(r):3);
end
mn

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by