How can I interpolate matrix?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
HyoJae Lee
el 5 de Mzo. de 2021
Comentada: Stephen23
el 6 de Mzo. de 2021
0 0 0 0 31.2117
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
33.4177 0 33.0571 0 32.2147
I have 5*5 matrix.
I want to interpolate zeros using nonzero values.
How can I make this one?
2 comentarios
Stephen23
el 5 de Mzo. de 2021
Do you only want to interpolate, or do you want to extrapolate as well?
(If you only want interpolation, the left hand upper triangular section will be NaN)
Respuesta aceptada
Stephen23
el 5 de Mzo. de 2021
M = [0,0,0,0,31.2117;0,0,0,0,0;0,0,0,0,0;0,0,0,0,0;33.4177,0,33.0571,0,32.2147]
[Xi,Yi] = find(M);
[Xo,Yo] = ndgrid(1:size(M,1),1:size(M,2));
A = griddata(Xi,Yi,nonzeros(M),Xo,Yo)
2 comentarios
KALYAN ACHARJYA
el 5 de Mzo. de 2021
Editada: KALYAN ACHARJYA
el 5 de Mzo. de 2021
@Stephen Cobeldick Sir, to what extent can we interpolate, is there any certain ways to measure the acceptibility of interpolated data points, because in this example available data points are very few only?
And yes you have shown in the best way, in the first section of the given data, there are no reference data points.
Thanks for your answer! This is learning for me tool. Appreciated!
Stephen23
el 6 de Mzo. de 2021
"is there any certain ways to measure the acceptibility of interpolated data points..."
No, there is no certain way to measure the acceptability. The usefulness of interpolation (and extrapolation) depends on having sufficient prior knowledge and understanding about the underlying physical process being modelled:
Más respuestas (1)
Ver también
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!