3D plot with multiple files

2 ビュー (過去 30 日間)
Darpan Verma
Darpan Verma 2019 年 2 月 15 日
編集済み: Cris LaPierre 2019 年 2 月 16 日
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.

採用された回答

Cris LaPierre
Cris LaPierre 2019 年 2 月 16 日
編集済み: Cris LaPierre 2019 年 2 月 16 日
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:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by