3D graph from scatter
1 view (last 30 days)
Show older comments
Hello, I have such a piece of code:
n=1;
i=0;
while i<iFileB
Bl=B{1,n}(:, 1);
Br=B{1,n}(:, 2);
Sl=S{1,n}(:, 1);
Sr=S{1,n}(:, 2);
C=Cr{1,n}(:, 1);
T=Cr{1,n}(:, 2);
ZP=Z{1,1}(n, 1);
sz1=3;
sz2=5;
c1 = 'red';
c2 = 'blue';
c3 = 'magenta';
c4 = 'cyan';
c = linspace(1,10,length(Bl));
scatter3(Bl, T, repmat(ZP, size(Bl)), sz1,c1, 'filled')
hold on
scatter3(Br, T, repmat(ZP, size(Br)), sz1,c2, 'filled')
hold on
scatter3(Sl, T, repmat(ZP, size(Bl)), sz2,c3, 'filled')
hold on
scatter3(Sr, T, repmat(ZP, size(Br)), sz2,c4, 'filled')
hold on
n=n+1;
i=i+1;
end
It gives me this kind of graph:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/516802/image.png)
What I would like to do is to create a figure based on these slices, I mean, I would like to have a solid edge in z dimensions. For instance, if those slices represent a crosssection of a sphere I would like to recreate "this sphere" out of slices. Similar to this https://www.mathworks.com/matlabcentral/answers/313108-how-to-convert-2d-graph-to-3d but in my case, I don't have a fixed equation and my shape changes over Z.
Is there any option to do this in Matlab?
I will be grateful for any help!
0 Comments
Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!