🌐
MathWorks
mathworks.com › matlabcentral › answers › 302997-plot-in-3d-over-time
Plot in 3D over Time - MATLAB Answers - MATLAB Central
September 14, 2016 - I have an excel spreadsheet where the first column is the time and the others are all the different data for the z component of my points over time. Do you know how I can include this in Matlab ? ... My ‘fcn’ function just calculates the z-data for the corresponding x- and y-grid points. Plotting data you have already acquired from a file should not be much different.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 1706320-3d-plot-using-time-series
3D plot using time series - MATLAB Answers - MATLAB Central
April 27, 2022 - To create different surface plots, change the ‘x’ and ‘y’ variables in my code to be the independent variables for the plot, and then use the appropriate ‘z’ vector in the griddata call. The code should be relatively robust to those changes. Sign in to comment. Sign in to answer this question. MATLAB Graphics 2-D and 3-D Plots Surfaces, Volumes, and Polygons Surface and Mesh Plots
🌐
MathWorks
mathworks.com › matlabcentral › answers › 580953-plotting-3d-graph-with-time-series
Plotting 3d graph with time series - MATLAB Answers - MATLAB Central
August 18, 2020 - Plotting 3d graph with time series. Learn more about 3d plots, plotting, time series, graph MATLAB
🌐
MathWorks
mathworks.com › matlab › language fundamentals › data types › time series
plot - Plot timeseries - MATLAB
p = plot(___) returns a Line object or an array of Line objects. Use p to modify properties of the plot after creating it. For a list of properties, see Line Properties. ... Create a time series object, set the start date, and then plot the time vector relative to the start date.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 441886-to-plot-x-y-z-according-to-time
To plot x y z according to time - MATLAB Answers - MATLAB Central
January 28, 2019 - https://www.mathworks.com/matlabcentral/answers/441886-to-plot-x-y-z-according-to-time#answer_358554 ... I tried couple of things on your code and change the subplots into vertical instead of horizontal. Looks better. I have added start and finish points with its legend to see the deplacement of the circles. But in 3D plot it looks very chaotic.
🌐
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › line plots
plot3 - 3-D line plot - MATLAB
Create plots by passing a table to the plot3 function followed by the variables you want to plot. When you specify your data as a table, the axis labels and the legend (if present) are automatically labeled using the table variable names. axis | scatter3 | bar3 | tiledlayout | nexttile | grid ...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 576343-time-series-in-3d
Time Series in 3D - MATLAB Answers - MATLAB Central
August 7, 2020 - Hello, Looking to create a time series 3D plot using excel .csv data. The plot would consist of rectangular solids that can be rotated. Each rectangular solid dimension, dependent on parameters fr...
Find elsewhere
🌐
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › discrete data plots
stem3 - Plot 3-D discrete sequence data - MATLAB
Time WindDirection WindSpeed Humidity ... 25-Oct-2021 00:02:09 36 2.2 84 49.2 0 0 29.96 4.138 0 · Plot the Time variable on the x-axis, the Temperature variable on the y-axis, and the CumulativeRainfall variable on the z-axis....
🌐
MathWorks
mathworks.com › matlabcentral › answers › 80486-fft-amplitude-3d-spectrum-of-a-time-series
FFT: Amplitude 3D Spectrum of a time series - MATLAB Answers - MATLAB Central
June 27, 2013 - I have a synchronously sampled time series. I wish to plot the 3D spectra of the time series (time (seconds), frequency (Hz), amplitude (dB)). Does matlab have a built in tool for this? I cant s...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 1641385-create-timeseries-of-a-3d-scattered-plot
Create timeseries of a 3d scattered plot - MATLAB Answers - MATLAB Central
February 2, 2022 - Create timeseries of a 3d scattered plot . Learn more about time series, data import, 3d plots, surface, cylinders
🌐
MathWorks
mathworks.com › matlab › graphics
2-D and 3-D Plots - MATLAB & Simulink
Use plots to visualize data. For example, you can compare sets of data, track changes in data over time, or show data distribution. Create plots programmatically using graphics functions or interactively using the Plots tab at the top of the MATLAB® desktop.
Top answer
1 of 2
7

The type of plot you are trying to make may be difficult to visualize well. I can give you two suggestions: one is what you want, and one is what you should probably do instead...

Plotting 4-D data:

In order to do this, you will have to plot a series of x,y,t points and somehow represent the error value e at each point. You could do this by changing the color or size of the point. In this example, I'll plot a sphere at each point with a diameter that varies based on the error (a diameter of 1 equates to the maximum expected error). The color represents the time. I'll be using the sample data you added to the question (formatted as a 5-by-4 matrix with the columns containing the x, y, t, and e data):

data = [4 5 2 45; 4 5 6 54; 7 8 2 32; 7 8 9 98; 7 8 1 121];
[x, y, z] = sphere;  % Coordinate data for sphere
MAX_ERROR = 121;     % Maximum expected error
for i = 1:size(data, 1)
  c = 0.5*data(i, 4)/MAX_ERROR;  % Scale factor for sphere
  X = x.*c+data(i, 1);           % New X coordinates for sphere
  Y = y.*c+data(i, 2);           % New Y coordinates for sphere
  Z = z.*c+data(i, 3);           % New Z coordinates for sphere
  surface(X, Y, Z, 'EdgeColor', 'none');  % Plot sphere
  hold on
end
grid on
axis equal
view(-27, 16);
xlabel('x');
ylabel('y');
zlabel('t');

And here's what it would look like:

The problem: Although the plot looks kind of interesting, it's not very intuitive. Also, plotting lots of points in this way will get cluttered and it will be hard to see them all well.

More intuitive 3-D plot:

It may be better to instead make a 3-D plot of the data, since it may be easier to interpret. Here, the x-axis represents the iteration number and the y-axis represents each individual network:

plot3(1:2, [1 1], [2 45; 6 54]);           % Plot data for network 4-5
hold on
plot3(1:3, [2 2 2], [2 32; 9 98; 1 121]);  % Plot data for network 7-8
xlabel('iteration number');
set(gca, 'YTick', [1 2], 'YTickLabel', {'network 4-5', 'network 7-8'})
grid on
legend('time', 'error')
view(-18, 30)

This produces a much clearer plot:

2 of 2
5

Even though I am not convinced this the best way to visualize the data, here's a simple way to do it as you asked. You can plot the 3D points in a simple scatter plot, and map the size OR the color to the values of the fourth dimension error. Something like:

x = randi(20, [10 1]);
y = randi(20, [10 1]);
t = randi(10, [10 1]);
e = randi(200, [10 1]);

% map `e` to color
figure(1)
scatter3(x, y, t, 200, e, 'filled')
xlabel('x'), ylabel('y'), zlabel('t')
colormap(hot), colorbar

% map `e` to size
figure(2)
scatter3(x, y, t, e, 'filled')
xlabel('x'), ylabel('y'), zlabel('t')