How to plot a 3D surface from a non square matrix?

Hi, I am a newbee in matlab and have some difficulty to plot a surface from matrix. Here is the problem, I have a matrix () and a vector and a vector. I want to plot a surface from the matrix with the two vectors as X and Y axis, respectively. Bu it is impossible to directly use the function 'surf' since . Does anyone know what should I do to generate the plot? Thanks a lot in advance.

 採用された回答

madhan ravi
madhan ravi 2018 年 12 月 7 日
編集済み: madhan ravi 2018 年 12 月 10 日

1 投票

Try the below example and adapt it to your needs:
x=1:10;
y=1:9;
z=rand(numel(x),numel(y));
[X,Y]=meshgrid(x,y); %redundant
surf(X,Y,z')

2 件のコメント

Lin Yang
Lin Yang 2018 年 12 月 10 日
Thank you very much madhan ravi, your solution works perfect!
madhan ravi
madhan ravi 2018 年 12 月 10 日
Anytime :)

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

その他の回答 (0 件)

カテゴリ

質問済み:

2018 年 12 月 7 日

コメント済み:

2018 年 12 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by