MATLAB: 3D plot with multiple files

3d plotsmatrix array

Hi, I have series of data in 41 simlar group of matrix size [1×88] [41×1] [41×88].
Here 41 similar groups means the points on X axis and matrix [41×1] means the points on the Y axis.
matrix [1×88] [41×88] is the data to be plotted.
I want to know how can I plot this data in 3D? where X axis and Y are positions.

Best Answer

There's some punctuation issues making it difficult to understand the description of your data. Here's what I understand:
  • X-values are contained in the matrix with dimensions [41x1]
  • Y-values are contained in the matrix with dimensions [1x88]
  • Z-values are contained in the matris with dimensions [41x88]
Still unsure how the multiple files factors in. However, yes, if you have those matrices as I described, you can plot in 3D. Now it just depends on what type of plot you want to create. Did you want a line plot? Scatter plot? Mesh? Surface? Plots are handled differently than surfaces. Meshes/surfaces are perfect for your data. With plots, you have to use meshgrid first. Just note that y values to meshgrid are rows of a matrix. Think of if you placed a 2D matrix directly on an X-Y axes.
Here's an example
x = linspace(0,2*pi,41)'; % 41x1
y = linspace(0,pi,88); % 1x88
z = sin(x).^2 * cos(y).^2; % 41x88
figure
surf(x,y,z')
xlabel('X')
ylabel('Y')
zlabel('Z')
figure
[Y,X] = meshgrid(y,x); % Make X and Y 41x88 as well
scatter3(X(:),Y(:),z(:)) % Use linear indexing to turn X, Y, and z into vectors.
xlabel('X')
ylabel('Y')
zlabel('Z')
Surface:
Scatter: