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

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Jos (10584)
Jos (10584) il 19 Dic 2013
Modificato: Jos (10584) il 19 Dic 2013
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

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by