3D plot where x and y has different length

조회 수: 3 (최근 30일)
mingcheng nie
mingcheng nie 2022년 12월 20일
답변: KSSV 2022년 12월 20일
Hi there,
If I want to plot a 3D surface with x,y,z variables, where x and y has diffrent length, then which function should I use? I saw most of plot require that x and y has same length.
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2022년 12월 20일
And how would that plot be? If you wanted to plot it with pen and paper, how would you do it?

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2022년 12월 20일
For a 3D plot (x,y) can have different lengths, if you are talking about pcolor, surf. HEre you are plotting a surface.
x = linspace(0,1,20) ;
y = linspace(0,1,30) ;
[X,Y] = meshgrid(x,y) ;
Z = sqrt(X.^2+Y.^2) ;
pcolor(X,Y,Z)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by