How to interpolate in 2d with the 3rd variable as a vector?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
UH
el 2 de Jun. de 2023
Respondida: Simon Chan
el 3 de Jun. de 2023
I have contour data and its x-y coordinates. I successfull plotted the data using griddata which shows contours around the points only. I want to interpolate the data in 2-dimension to have the plot spreaded over 160x60 grid. I tried using interp2(x,y,dt,x1,y1) but it gives error "Interpolation requires at least two sample points for each grid dimension." Is there a way the interpolation is carried out in 2-dimension and the contour shows up to the limits, or my data are insufficient for 2d interpolation?
I would appreciate help.
~Best
dt = [3.96 4.36 0.6 2.6 1.44 3.84 3.64 0.72];
x = [80 120 40 60 100 100 80 80];
y = [40 60 80 80 80 120 160 0];
[x1,y1] = meshgrid(0:20:160,0:20:160);
z1 = griddata(x,y,dt,x1,y1);
contourf(x1,y1,z1,'ShowText','on');
grid on
0 comentarios
Respuesta aceptada
Simon Chan
el 3 de Jun. de 2023
dt = [3.96 4.36 0.6 2.6 1.44 3.84 3.64 0.72];
x = [80 120 40 60 100 100 80 80];
y = [40 60 80 80 80 120 160 0];
[x1,y1] = meshgrid(0:20:160,0:20:160);
z1 = griddata(x,y,dt,x1,y1);
idxNaN = isnan(z1);
znew = fillmissing2(z1,'nearest','MissingLocations',idxNaN);
contourf(x1,y1,znew,'ShowText','on');
grid on
0 comentarios
Más respuestas (0)
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!