Clear Filters
Clear Filters

Not able to interpolate the corners of figure using ScattteredInterpolation function

2 views (last 30 days)
I have a data which is scattered and I want to regularise the data using ScatterredInterpolation function. The point cloud, I'm working is a square tube(rawfigure attached). When I try to regularise the data using ScatterredInterpolation, I'm getting a figure something like this (transformedfig attached), which has large undulations at the corners of the tube (it is supposed to be smooth edge like in the 'rawfigure'). Please let me know what could be the problem and solution.
code which I'm using is,
CTP = [R theta Y]; %.mat file attached
O_x = 1.5940;
O_z = -66.2657;
max_y = max(Y);
min_y = min(Y);
F = scatteredInterpolant(CTP(:,2), CTP(:,3), CTP(:,1)); %Interpolation funcntion for "R"
Xq = 0:4*pi()/(180):2*pi(); %mesh in x direction
Yq = min_y:4:max_y; %mesh in y direction
[XQ, YQ] = meshgrid(Xq, Yq);%meshgrid with the predefined size
ZQ = F(XQ, YQ); %"R" values for the meshgrid
[m n] = size(XQ);
for i = 1:n:n*(m)
C([i:i+(n-1)],[1:3]) = [XQ(((n-1)+i)/n,:)' YQ(((n-1)+i)/n,:)' ZQ(((n-1)+i)/n,:)'];
end
X1 = -C(:,3).*cos(C(:,1))+O_x; %Reverse transform to cartesian coordinates
Z1 = C(:,3).*sin(C(:,1)) + O_z; %Reverse transform to cartesian coordinates
Y1 = C(:,2); %Reverse transform
P1 = [X1 Y1 Z1]; %arranging cartesian coordinates
Pc = pointCloud(P1);
pcshow(Pc)
Thanks,

Answers (0)

Community Treasure Hunt

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

Start Hunting!