X=0:0.01:0.2;
Y=0:0.01:0.2;
T=a matrix with 441*1 dimension that start from 22 to 36
Z=zeros(441,1);
Z=T;
how can i code a surf graph (X , Y,Z)?

4 件のコメント

KSSV
KSSV 2021 年 2 月 17 日
You need to have a relation/ function for T/Z depeding on X,Y. What is that relation?
bahareh bshrt
bahareh bshrt 2021 年 2 月 17 日
There is no relation between x,y and z. I want plot that x,y axis is 0:0.01:0.2 and z axis is matrix with dimension 441*1 and first cell is 22 and last cell is 36 ... Is it possible to code a surfplot???
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 17 日
@bahareh bshrt have you see the example surf plots in MATLAB Docs?
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 17 日
It's clearly stated in MATLAB Doc, the grid planes are form with the x and y dimentions. And the third z component represents the height of the particular grid.
X=0:0.01:0.2;
Y=0:0.01:0.2;
Next Form the grid plane
[x1,y1]=meshgrid(X,Y);
The result would be as following
Next task: Assign the Z value (Hence Z must be MATRIX, as you have to assign the value in the respective grids)
Here I have created any random matrix with size MxN (M=size of X,N=size of Y) and MATRIX values in the range of 22 and 36, as you have mentioned in the question.
Z=randi([22,36],[length(X),length(Y)]);
Surf plot
surf(x1,y1,Z);
Please refer the MATLAB Docs surf and see the dimensions of all x,y,z, it would be much easy to understand.

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

 採用された回答

KSSV
KSSV 2021 年 2 月 17 日

2 投票

x = 0:0.01:0.2 ; nx = length(x) ;
y = 0:0.01:0.2 ; ny = length(t) ;
[X,Y] = meshgrid(x,y) ;
Z = reshape(z,nx,ny) ;
surf(X,Y,Z)

1 件のコメント

bahareh bshrt
bahareh bshrt 2021 年 2 月 17 日
Thank You so much

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

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2021 年 2 月 17 日

コメント済み:

2021 年 2 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by