Hi, I have series of data in 41 simlar group of matrix size [1x88] [41x1] [41x88].
Here 41 similar groups means the points on X axis and matrix [41x1] means the points on the Y axis.
matrix [1x88] [41x88] 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.

 Réponse acceptée

Cris LaPierre
Cris LaPierre le 16 Fév 2019
Modifié(e) : Cris LaPierre le 16 Fév 2019

0 votes

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:

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by