arrays - Data field shifting trough a vector of data in matlab -
i need create data field go through vector. data field constant length, , going through data vector shifting data field data field length. need mean value of field (a vector) corresponds mean value of field (b vector).
example:
a=[1 5 7 8 9 10 11 13 15 18 19 25 28 30 35 40 45 48 50 51]; b=[2 4 8 9 12 15 16 18 19 20 25 27 30 35 39 40 45 48 50 55];
i want next:
a=[{1 5 7 8 9} 10 11 13 15 18 19 25 28 30 35 40 45 48 50 51]; b=[{2 4 8 9 12} 15 16 18 19 20 25 27 30 35 39 40 45 48 50 55];
i want take data field of 5 points , mean value. , shift whole data field data field length.
a=[1 5 7 8 9 {10 11 13 15 18} 19 25 28 30 35 40 45 48 50 51]; b=[2 4 8 9 12 {15 16 18 19 20} 25 27 30 35 39 40 45 48 50 55];
i need 2 vectors, c , d mean values of method.
c=[6 13.4 27.4 45.2]; d=[7 17.6 31.2 47.6];
i started with
n = length(a); k = 1:n ....
but nothing tried worked.
thanks.
reshape
vector 5-row matrix , compute mean
of each column:
c = mean(reshape(a,5,[]),1); d = mean(reshape(b,5,[]),1)
Comments
Post a Comment