How to interpolate a matrix

53 visualizaciones (últimos 30 días)
Harry klop
Harry klop el 26 de Abr. de 2022
Comentada: Voss el 26 de Abr. de 2022
Hi,
I'm trying to interpolate this matrix, so that I gain an extra 10 data points between each row. I do not want any more data points between the columns. Please could somone help with what I can use to do this?

Respuesta aceptada

Voss
Voss el 26 de Abr. de 2022
data = randi(100,8)
data = 8×8
14 47 55 55 59 23 42 98 47 13 97 77 67 42 3 44 75 63 67 39 87 9 43 7 22 9 12 21 5 11 75 23 81 47 67 53 19 61 91 95 88 81 57 22 63 92 87 87 16 88 95 80 37 86 39 79 76 10 45 38 88 69 61 93
n = size(data,1);
data_interp = interp1(1:n,data,linspace(1,n,11*(n-1)+1))
data_interp = 78×8
14.0000 47.0000 55.0000 55.0000 59.0000 23.0000 42.0000 98.0000 17.0000 43.9091 58.8182 57.0000 59.7273 24.7273 38.4545 93.0909 20.0000 40.8182 62.6364 59.0000 60.4545 26.4545 34.9091 88.1818 23.0000 37.7273 66.4545 61.0000 61.1818 28.1818 31.3636 83.2727 26.0000 34.6364 70.2727 63.0000 61.9091 29.9091 27.8182 78.3636 29.0000 31.5455 74.0909 65.0000 62.6364 31.6364 24.2727 73.4545 32.0000 28.4545 77.9091 67.0000 63.3636 33.3636 20.7273 68.5455 35.0000 25.3636 81.7273 69.0000 64.0909 35.0909 17.1818 63.6364 38.0000 22.2727 85.5455 71.0000 64.8182 36.8182 13.6364 58.7273 41.0000 19.1818 89.3636 73.0000 65.5455 38.5455 10.0909 53.8182
isequal(data_interp(1:11:end,:),data) % every 11th row is the original data
ans = logical
1
  2 comentarios
Harry klop
Harry klop el 26 de Abr. de 2022
That's brilliant, thanks very much!
Voss
Voss el 26 de Abr. de 2022
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation 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!

Translated by