Solid interpolation from surfaces
조회 수: 5 (최근 30일)
이전 댓글 표시
I have an external set of 4D data with dimensions (k,l,m,n), from which I have first created a cell array {m,n}(k,l), then I have used a matrix to sum the different matrices on the single column in m and interpolated, creating n surfaces. Using interp2 and defining the desired point on one of the n surfaces, I can obtain the desired value for the fixed n value of the surface.
This is the code relative to it:
[Xq,Zq]=meshgrid(linspace(palpha_n,palpha_x,dxsurf*palpha_dx),linspace(pRe_n,pRe_x,dxsurf*pRe_dx));
alpha=20;
Re=4e6;
Ma=0.12;
pol_r=cell(1,size(pol_surf,2));
for iMa=1:size(pol_surf,2)
j=1;
for iRe=1:size(pol_surf,1)
for ialpha=1:size([pol_surf{iRe,iMa}],1)
pol_r{iMa}(j,:)=num2cell(pol_surf{iRe,iMa}(ialpha,:));
j=j+1;
end
end
figure
scatter3(cell2mat(pol_r{iMa}(:,1)),cell2mat(pol_r{iMa}(:,2)),cell2mat(pol_r{iMa}(:,8)),'filled','Color',[iMa./size(pol_surf,2) iMa./size(pol_surf,2) iMa./size(pol_surf,2)]);
FCl=scatteredInterpolant(cell2mat(pol_r{iMa}(:,1)),cell2mat(pol_r{iMa}(:,8)),cell2mat(pol_r{iMa}(:,2)));
Clq(:,:,iMa)=FCl(Xq,Zq);
Cl_interp(:,iMa)=mesh(Xq,Clq(:,:,iMa),log10(Zq));
Cl(:,iMa)=interp2(Xq,Zq,Clq(:,:,iMa),alpha,Re);
end
I would like now to interpolate the n surfaces into a solid, in order to replicate the same interpolation process on the higher dimension and keeping the information relative to the surface, but I have no idea how to tackle the problem.
Any suggestions?
댓글 수: 0
답변 (1개)
Shubham
2023년 9월 27일
I understand that you have created n surfaces from the 4D data and now you want to interpolate these surfaces into a solid.
You can use the “interp3” function for interpolating the 3D data in a mesh-grid format.
You can also refer to “griddedInterpolant” function which can perform interpolation on N-D gridded data set.
For more information please refer to:
Hope this helps!!
댓글 수: 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!