Create 3D scatter plot from an 120x160 matrix
1 回表示 (過去 30 日間)
古いコメントを表示
I have an excel file with a 120 x 160 array and I need to make a 3D scatter plot of the data. I could easily do it on Mathcad but can't get 'scatter3' to work.
Any suggestions will be appreciated!
Thanks
0 件のコメント
回答 (2 件)
Chad Greene
2017 年 7 月 7 日
Perhaps you need to columnate all your variables using (:). Like this:
[x,y,z] = peaks(150);
scatter3(x(:),y(:),z(:),10,z(:))
But if your data are gridded, why not use surf?
surf(x,y,z)
shading flat
2 件のコメント
Chad Greene
2017 年 7 月 10 日
Yes, by columnating all the inputs with (:), it turns them into vectors. Did you try the example I provided with the peaks data?
Walter Roberson
2017 年 7 月 7 日
編集済み: Walter Roberson
2017 年 7 月 7 日
[Y, X] = ndgrid(1:size(YourArray,1), 1:size(YourArray,2));
scatter3(X(:), Y(:), YourArray(:));
Notice that Y corresponds to rows not columns
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!