This is my one dimensional array A
. containing 10 numbers
A = [-8.92100000000000 10.6100000000000 1.33300000000000 ...
-2.57400000000000 -4.52700000000000 9.63300000000000 ...
4.26200000000000 16.9580000000000 8.16900000000000 4.75100000000000];
I want the loop to go through like this; (calculating mean interval wise) - Interval length of 2,4,8
(a(1)+a(2))/2
- value stored in one block of a matrix say m= zeros(10)- then
(a(1)+a(2)+a(3)+a(4))/4
------ mean----- - then
(a(1)+a(2)..... a(8))/8
then shift index;
(a(2)+a(3))/2;
- mean(a(2)+a(3)+a(4)+a(5))/4
(a(2)+a(3)...a(9))/8
SO basically 2^n length interval
You could do this using
conv
without loopsOutput for the sample Input:
Finding Standard Deviation for an example (
std_4
)Output for the sample Input:
Full code for OP