Solid interpolation from surfaces

9 vues (au cours des 30 derniers jours)
Filippo Sanangelantoni
Filippo Sanangelantoni le 19 Juil 2022
Réponse apportée : Gojo le 27 Sep 2023
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?

Réponses (1)

Gojo
Gojo le 27 Sep 2023
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!!

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by