필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
Nilly
Nilly 2020년 10월 6일
댓글: Asad (Mehrzad) Khoddam 2020년 10월 6일
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
Nilly
Nilly 2020년 10월 6일
편집: Nilly 2020년 10월 6일
sorry. n1 = -5 , n2= 5
z0_el = 6;
Asad (Mehrzad) Khoddam
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 CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by