Borrar filtros
Borrar filtros

How to interpolate a 3d surface with the different size of squares?

4 visualizaciones (últimos 30 días)
Nilly
Nilly el 6 de Oct. de 2020
Comentada: Asad (Mehrzad) Khoddam el 6 de Oct. de 2020
I have a surface between a range -5 to 5 on both x and y axis. I would like to interpolate this surface with a new meshgrid data which has different size for each iteration. However, I cannot get the entire surface with interpolated new data. I only get the different size of squares. Is there a way to interpolate the original surface with different grid spacing ? Here is my code as well. Figure 1 is my original surface. and Figure 4 is interpolated surface which is missing the original surface itself. What I would like to have is Figure 4 in Figure 1.
L1 = 4;
L2 = 3;
L1 = L1;
[xP,yP] = meshgrid(n1:n2);
zP = real( L3*sqrt(1-((xP.^2)/ (L1^2)) - ((yP.^2)./ (L2^2))));
for i =1:length(CoordsX(:,1))
sqx=[min(CoordsX(i,:)), max(CoordsX(i,:))] ;
sqy=[min(CoordsY(i,:)), max(CoordsY(i,:))];
[x,y,z] =rotation(180-alpha,xP,yP,zP);
[Xq,Yq] = meshgrid(sqx,sqy);
Vq = interp2(xP,yP,z+z0_el,Xq,Yq,'cubic');
surf(Xq,Yq,Vq)
hold on
daspect([1 1 1])
end
  3 comentarios
Nilly
Nilly el 6 de Oct. de 2020
Editada: Nilly el 6 de Oct. de 2020
sorry. n1 = -5 , n2= 5
z0_el = 6;
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam el 6 de Oct. de 2020
The lower an upper limits of sqx and sqy are less than the original limits of xP and yP. So, you miss some data points.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots 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