How do I create such matrix ? (please look at the thread for further details)

1 回表示 (過去 30 日間)
Derick Wong
Derick Wong 2013 年 12 月 19 日
コメント済み: Derick Wong 2013 年 12 月 19 日
Hi,
Let say I have a matrix [ X1 X2 X3 X4 X5... Xm; Y1 Y2 Y3 Y4 Y5... Ym; Z1 Z2 Z3 Z4 Z5... Zm]
I need to use a method base on X1, X2 and X3 to get my new X4, X5 till Xm and same goes for Y and Z.
For X
The method in order to find X4 is X4=(X1+X2+X3)/3. Once X4 is calculated, we use the X4 to calculate X5 which now the it will turn out to be X5=(X2+X3+X4)/3 and find X6 using the found X5 and X4, X6=(X3+X4+X5)/3 and so on until we find Xm.
same goes for Y and Z.
My question is, how do we come out with such matrix if there is 93 rows and 343 column?

採用された回答

Jos (10584)
Jos (10584) 2013 年 12 月 19 日
編集済み: Jos (10584) 2013 年 12 月 19 日
So, the original values X4, X5 etc. are not used at all?
XYZ = ceil(10*rand(4,6)) % example data
RESULT = zeros(size(XYZ)) ;
RESULT(:,[1 2 3]) = XYZ(:,[1 2 3])
M = size(XYZ,2) ;
for k = 4:M
RESULT(:,k) = sum(RESULT(:,k-[1 2 3]),2)/3
end

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by