How to plot 3D data in 2D graph

168 visualizaciones (últimos 30 días)
Lukas Cierny
Lukas Cierny el 18 de Nov. de 2020
Comentada: Lukas Cierny el 19 de Nov. de 2020
Hello all,
I need help how to plot 3D data on 2D graph. I have data measured in time for example from t = 0s to t = 60s for each time is certain value of electric current (x-axis) versus some quantity (y-axis). I need to plot y versus electric current (x-axis), but still with respect to time.
Thank you very much for a hint in advance.

Respuestas (1)

Cris LaPierre
Cris LaPierre el 18 de Nov. de 2020
You could create a 3D plot, and then rotate it so you are just looking at the XY plane. You can do this using view(2). You could try to use color to represent the value of your 3rd variable.
What works is going to be very dependent on your data. You might consider the answer provided here if your plot is a line.
% 3D
t = linspace(0,10,500);
xt = exp(-t./10).*sin(5*t);
yt = exp(-t./10).*cos(5*t);
patch([xt NaN],[yt NaN],[t NaN],[t NaN],'FaceColor','none','EdgeColor','interp');
xlabel("X")
ylabel("Y")
zlabel("Time")
cb=colorbar;
cb.Title.String = "Time";
colormap jet
view(3)
%2D
figure
patch([xt NaN],[yt NaN],[t NaN],'FaceColor','none','EdgeColor','interp');
xlabel("X")
ylabel("Y")
cb=colorbar;
cb.Title.String = "Time";
colormap jet
  1 comentario
Lukas Cierny
Lukas Cierny el 19 de Nov. de 2020
Hello, thank you very much for so quick response. I will try it, but seems to be good procedure.

Iniciar sesión para comentar.

Categorías

Más información sobre Green en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by