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?