Solid interpolation from surfaces
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
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!!
0 commentaires
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!