How do i contruct 3D Data like in my example

x,y are the coordinates of the circle points.
z is the brightness of the points.
so i have this
I want to create something like this (blue lines)
How can i do that? I tried some things with meshgrid, surf() and i tried to use scatteredInterpolant() too but i cant really figure it out.
Anyone know some useful keywords or functions?
Here is the code used to generate the plots...
A = readmatrix('simucoord.txt')
x = A(:,1)
y = A(:,2)
z = A(:,3)
Radii = floor(A(:,4))
%plotting the data
plot3(x,y,z, 'r*')
%%%IGNORE EVERYTHING BELOW%%%
x_center = 1.2533*10^3; %from simulation_23072020.mlx
y_center = 0;
clear x y z
%Plotting the data with the help of the Radii
th = 0:pi/50:pi;
x{1} = Radii(1) .* cos(th)-x_center;
y{1} = Radii(1) .* sin(th);
z{1} = ones(length(x{1}),1)*4;
x{2} = Radii(25) .* cos(th)-x_center;
y{2} = Radii(25) .* sin(th);
z{2} = ones(length(x{1}),1)*4;
x{3} = Radii(77) .* cos(th)-x_center;
y{3} = Radii(77) .* sin(th);
z{3} = ones(length(x{1}),1)*4
x{4} = Radii(99) .* cos(th)-x_center;
y{4} = Radii(99) .* sin(th);
z{4} = ones(length(x{1}),1)*3
x{5} = Radii(133) .* cos(th)-x_center;
y{5} = Radii(133) .* sin(th);
z{5} = ones(length(x{1}),1)*3
plot3(x{1}, y{1}, z{1}, x{2}, y{2}, z{2}, x{3}, y{3}, z{3}, x{4}, y{4}, z{4}, x{5}, y{5}, z{5})
xlim([0 1000])
ylim([0 1000])

7 comentarios

Cris LaPierre
Cris LaPierre el 23 de Jul. de 2020
I'm confused. I think we need more information to help. What is the point of X and Y? For the plotting code you share, you make up the x and y data rather than using the imported data.
Hoschang Noori
Hoschang Noori el 23 de Jul. de 2020
Editada: Hoschang Noori el 23 de Jul. de 2020
I used the imported data :
%plotting the data
plot3(x,y,z, 'r*')
the simucoords.txt contains x,y,z coordinates and the radius of the original circle.
I think we can actually ignore everything below this line of code,
since i just tried to seperate the circles because i thought it may be easier to find a solution.
KSSV
KSSV el 23 de Jul. de 2020
Your (x,y) are points lying on different circles. I have no idea how it is possible to get the picture attached.
Hoschang Noori
Hoschang Noori el 23 de Jul. de 2020
Thanks for making me aware, i edited my post
Cris LaPierre
Cris LaPierre el 23 de Jul. de 2020
I think the point is we do not know what the blue lines you are drawing on the plot are supposed to be. Do you know how to create them and are asking for help on how to add it to the existing plot, or are you asking for help in creating the data?
Hoschang Noori
Hoschang Noori el 24 de Jul. de 2020
Editada: Hoschang Noori el 24 de Jul. de 2020
Oh okay. I want to generate more circle segments on the blue lines. In the end it should look like the main circle segments are "fading away" (z gets lower).
A little bit like what scatteredInterpolant() seems to do.
The end goal is to make a matrix out of the plot, similiar to this one (without the noise)
I hope this makes it clearer now...
I think i got a good idea how to handle this. I will use cylinder.
A = readmatrix('simucoord.txt');
%Generating Cylinder (just for one circle for now).
Radii = floor(A(:,4));
t = 0:pi/10:pi;
cols = length(t);
r = Radii(1) - 1000*cos(t);
[X,Y,Z] = cylinder(r,100);
%Save positive values, reshape matrices
X = X(X>0); X = reshape(X,cols,[]);
Y = Y(X>0); Y = reshape(Y,cols,[]);
Z = Z(X>0); Z = reshape(Z,cols,[]);
%show surface
surf(X,Y,Z)
%plot circles above a specific value.
ax = 0.6
x_saved = X(Z>ax)
y_saved = Y(Z>ax)
z_saved = Z(Z>ax)
plot3(x_saved,y_saved,z_saved, 'r*')
view([0 90.000])
%Transform the plot into a matrix....

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Polar Plots en Centro de ayuda y File Exchange.

Preguntada:

el 23 de Jul. de 2020

Comentada:

el 24 de Jul. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by