Mean value of array

3 visualizaciones (últimos 30 días)
Chihiro Omori
Chihiro Omori el 12 de Abr. de 2019
Editada: Guillaume el 12 de Abr. de 2019
I need to calculate the mean of [1 2 ; 9 10],[2 3 ; 10 11] [3 4 ; 11 12] ,[4 5 ; 12 13] ....and make 3*7 matrix of the mean values of A(=4*8 matrix).
Does anyone has idea how to make it?
A=[1 2 3 4 5 6 7 8 ;
9 10 11 12 13 14 15 16;
17 18 19 20 21 22 23 24;
25 26 27 28 29 30 31 32]
  3 comentarios
Chihiro Omori
Chihiro Omori el 12 de Abr. de 2019
I would like the output below.
A_mean = [5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5;
13.5 14.5, 15.5, 16.5, 17.5, 18.5, 19.5;
21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5]
The first row represents that ... 5.5 = ((1+2+9+10)/4) , 6.5 = ((2+3+10+11)/4), ...
The second row represents ... 13.5 = ((9+10+17+18)/4), ......
Guillaume
Guillaume el 12 de Abr. de 2019
You've been given two methods to achieve that output.

Iniciar sesión para comentar.

Respuesta aceptada

Guillaume
Guillaume el 12 de Abr. de 2019
Editada: Guillaume el 12 de Abr. de 2019
Trivially solved with a convolution
A=[1 2 3 4 5 6 7 8 ;
9 10 11 12 13 14 15 16;
17 18 19 20 21 22 23 24;
25 26 27 28 29 30 31 32]
conv2(A, ones(2)/4, 'valid') %comvolve with [0.25, 0.25; 0.25, 0.25]

Más respuestas (1)

KSSV
KSSV el 12 de Abr. de 2019

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by