I am working on a project where we make measurements in a linear fashion and rotate the sample in order to produce a 3D surface map.
The data comes from a polar format, we have 4 datasets:
theta = 0 , r = -20 -- 20
theta = 45 , r = -20 -- 20
theta = 90 , r = -20 -- 20
theta = 135, r = -20 -- 20
I can transform this into cartesian points by generating x and y vectors with sin and cos and plotting the result against that matrix.
So an example "ready to plot" matrix set looks something like this:
x [4x21 double]
-20 -18 -16 ..
-14.14 -12.73 -11.31 ..
0 0 0 ..
..
y [4x21 double]
0 0 0 ..
-14.14 -12.73 -11.31 ..
-20 -18 -16 ..
..
z [4x21 double]
.224 .281 .320 ..
.228 .280 .312 ..
.282 .349 .377 ..
..
The output surface plot with some basic formatting is like this:

Matlab is connecting between the vectors which I want. However, it is not connecting the 90-degree rotation to the 135-degree rotation. How do I make it do this?
The basic code to produce a figure similar to the example above is this:
theta = [ 0 , -45 , -90 , -135];
r = -20 : 2 : 20;
for i = 1 : 4
xc(i,:) = r .* cosd(theta(i));
yc(i,:) = r .* sind(theta(i));
zc(i,:) = [[0 : 0.1 : 0.9] , [1 : -0.1 : 0]];
end
figure
surf(xc,yc,zc);


pol2cartto convert from polar to Cartesian coordinates. Are you plotting withsurf? - David