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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by