Plotting 3D scatter plot from elements in a matrix

30 ビュー (過去 30 日間)
Vishakha Ramani
Vishakha Ramani 2019 年 9 月 9 日
コメント済み: Vishakha Ramani 2019 年 9 月 10 日
Hello all,
I have a matrix A with dimensions 47 x 4. I would like to plot the values in the matrix in a 3D plot. For e.g element A(4, 5) = 12 should be represented with x=4, y=5 and z= 12. Since, the values are non-uniform, I think a 3D scatter plot would be a good way to visualize the data. But, I tried mesh as well as surf to represent the data but the figure obtained was weird. Something like following. Could someone please help me converting this to a 3D scatter plot.
untitled.jpg

採用された回答

Adam Danz
Adam Danz 2019 年 9 月 9 日
編集済み: Adam Danz 2019 年 9 月 10 日
m = randi(100,47,4); % Here is your (fake) 47x4 data
[x ,y] = ndgrid(1:size(m,1),1:size(m,2)); % produce x and y coordinates
plot3(x(:),y(:),m(:), 'o') % plot it
grid on % turn on the grid (optional, of course)
190910 065543-Figure 1.jpg
  1 件のコメント
Vishakha Ramani
Vishakha Ramani 2019 年 9 月 10 日
Thank you very much. At least I got the idea of how to go about approaching such cases.

サインインしてコメントする。

その他の回答 (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