Creating a 3D surface plot from a matrix

2 ビュー (過去 30 日間)
Josh K
Josh K 2017 年 12 月 12 日
コメント済み: Josh K 2017 年 12 月 12 日
I am trying to create a 3D surface plot with a 50 x 3 matrix. The first 2 columns represent an x and y location and the 3rd column represents a value for the xy point. I am unable to figure out how to create the plot without errors. Thanks.
  2 件のコメント
Stephen23
Stephen23 2017 年 12 月 12 日
@Josh K: what have you tried so far?
Josh K
Josh K 2017 年 12 月 12 日
I was trying the surf function but I was having problems with my z being a scalar and not a matrix. The griddata function worked.

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

採用された回答

Star Strider
Star Strider 2017 年 12 月 12 日
That would only be possible if your data are gridded (so the x and y data are in regular patterns).
Probably the easiest way to determine that is to plot it with stem3. If the (x,y) data appear to regularly-spaced so the z data approximates a surface, use the reshape function on each of the vectors to form the required matrices.
If your data are scattered, use the griddata (link) function or one of its friends (linked to at the end of that page) to create your requisite gridded data to use with surf.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by