How to interpolate a 3d surface with the different size of squares?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Asad (Mehrzad) Khoddam
2020-10-6
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!