Enlarge vector by putting average of surrounding numbers in between of every number of original vector
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jorge Montane
el 17 de En. de 2018
How to make a longer vector by adding an additional element between neighboring elements in the original vector. Each new element should equal the average of its neighboring elements. x = [0 2 3 2 1 -1]
3 comentarios
Respuesta aceptada
Birdman
el 17 de En. de 2018
x(3:2:2*numel(x)-1)=x(2:end);
for i=2:2:numel(x)-1
x(i)=(x(i-1)+x(i+1))/2
end
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!