how to calculate the average of two values data that side by side and place it between those two values
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Madania Nia
el 26 de Feb. de 2020
Comentada: Madania Nia
el 26 de Feb. de 2020
i want to calculate the average of two values data that side by side and place it between those two values
for example i have matrix
A=[3;5;7;1;3]
the average of those data that side by side is [4;6;4;2]
then i want it to become
B=[3
4
5
6
7
4
1
2
3]
0 comentarios
Respuesta aceptada
Bhaskar R
el 26 de Feb. de 2020
mn = movmean(A, 2, 'Endpoints','discard');
Result = zeros(1, length(A)+length(mn));
Result(1:2:end) = A;
Result(2:2:end) = mn
Más respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!