How to add a cylinder to a scattered plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Greek McCoy
am 26 Nov. 2021
Kommentiert: Greek McCoy
am 26 Nov. 2021
Hello everyone,
I currently have a 3D data plot which I will like to superimpose with a cylinder.
Here is my current code:
%clear all;
%close all;
clc
A = load ('Data.txt');
x = A (:,1 ) ;
y = A (:,2 ) ;
z = A (:,3 ) ;
Amplitude = A (:,4) ;
scatter3 (x , y, z, 30, Amplitude )
title ('Cylinderical Sample')
xlim ([-0.07 0.07])
ylim ([-0.09 0.09])
zlim ([0 0.10])
xlabel ('Breath /m')
ylabel ('Width /m')
zlabel ('Height /m')
pbaspect([1 1 2])
H = colorbar ;
ylabel (H, 'Amplitude')
And results:
My challenge is that should i try to include a cylinder, I lose seeing the points in my scattered plot.
Here is the code I prepared to include the cylinder:
%clear all;
%close all;
clc
A = load ('Data.txt');
x = A (:,1 ) ;
y = A (:,2 ) ;
z = A (:,3 ) ;
Amplitude = A (:,4) ;
r = 0.025;
scatter3 (x , y, z, 30, Amplitude);
[X,Y,Z] = cylinder(r);
surf (X,Y,Z);
title ('Sample - VS 126')
xlim ([-0.07 0.07])
ylim ([-0.09 0.09])
zlim ([0 0.10])
xlabel ('Breath /m')
ylabel ('Width /m')
zlabel ('Height /m')
pbaspect([1 1 2])
H = colorbar ;
ylabel (H, 'Amplitude')
And here is how I have the results now:
Top View of Results:
Is it possible that I can get some assistance with including the cylinder into the scattered plot?
Thank you.
--
Greek
0 Kommentare
Akzeptierte Antwort
Chunru
am 26 Nov. 2021
% A = load ('Data.txt');
A = 0.05*rand(8, 4)
x = A (:,1 ) ;
y = A (:,2 ) ;
z = A (:,3 ) ;
Amplitude = A (:,4) ;
scatter3 (x , y, z, 30, Amplitude )
title ('Cylinderical Sample')
xlim ([-0.07 0.07])
ylim ([-0.09 0.09])
zlim ([0 0.10])
xlabel ('Breath /m')
ylabel ('Width /m')
zlabel ('Height /m')
pbaspect([1 1 2])
H = colorbar ;
ylabel (H, 'Amplitude')
hold on
r = 0.025;
[X,Y,Z] = cylinder(r);
surf (X,Y,Z, 'EdgeColor', 'none', 'FaceAlpha', 0.2);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!