Plotting data in 3D

I have a matrix that contains magnetic data in 3 axis (x,y,z) along with time (4th column). I need to plot this in a 3D graph, not points but lines of diffeernt color or some kind of mesh/net structure. How can i do that?

2 comentarios

KSSV
KSSV el 23 de Mayo de 2023
Attach your data.
Kanica Sachdev
Kanica Sachdev el 24 de Mayo de 2023
@KSSV I have attached the data.

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 24 de Mayo de 2023

0 votos

T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1392204/plotdata.xlsx') ;
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
plot3(T.(3),T.(4),T.(5),'r')

7 comentarios

Kanica Sachdev
Kanica Sachdev el 25 de Mayo de 2023
Thank you so much for your response. However, I want to show the three magnetic feild values with repsect to time. Currently, I have three graphs X(ut) vs time, Y(ut) vs time and Z(ut) vs time. I want to plot these three on a single graph
KSSV
KSSV el 25 de Mayo de 2023
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1392204/plotdata.xlsx') ;
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
figure
hold on
plot(T.(1),T.(3),'r')
plot(T.(1),T.(4),'b')
plot(T.(1),T.(5),'g')
legend('x','y','z')
Kanica Sachdev
Kanica Sachdev el 25 de Mayo de 2023
Thank you so much for your response. Can I get some kind of mesh/ net structure instead of lines?
KSSV
KSSV el 25 de Mayo de 2023
How you are expecting a mesh? At a time step only one point is given in the data.
Kanica Sachdev
Kanica Sachdev el 25 de Mayo de 2023
Something that can represent the magnetic feild in different directions. To visualize that the feilds are in x, y and z directions and not in a 2d plot
KSSV
KSSV el 25 de Mayo de 2023
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1392204/plotdata.xlsx') ;
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
x = T.(3) ;
y = T.(4) ;
z = T.(5) ;
dx = gradient(x) ;
dy = gradient(y) ;
dz = gradient(z) ;
quiver3(x,y,z,dx,dy,dz)
Kanica Sachdev
Kanica Sachdev el 25 de Mayo de 2023
In the above plot, the time data is missing. Can we represent it all in one plot?

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Mayo de 2023

Comentada:

el 25 de Mayo de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by