surfnorm function shows error

조회 수: 2 (최근 30일)
Sara
Sara 2020년 11월 15일
댓글: Ameer Hamza 2020년 11월 15일
Hi,
I am trying to use surfnorm function to calculate the nor of 3D meshgrid. But the use of the functions shows error "Y and Z must be the same size as X." which I do not understand why!!
The size of X,Y,Z are the same even though the document in mathwork says it is possible to use meshgrid as an input as attached in the questions
x = linspace(-1,1,10);
y = x;
z = x;
[X,Y,Z]=meshgrid(x,y,z);
figure,
surfnorm(X,Y,Z);

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 15일
편집: Ameer Hamza 2020년 11월 15일
X, Y, and Z must be 2D matrices. Z is a function of X and Y in this case. The following shows an example of how to use it properly
x = linspace(-1,1,10);
y = x;
[X,Y]=meshgrid(x,y);
Z = X+Y; % Z=X+Y is chosen as an example to show Z is a function of X and Y
figure,
surfnorm(X,Y,Z);
  댓글 수: 2
Sara
Sara 2020년 11월 15일
Thank you for your respnd,
I now understand the error,
Thank you.
Ameer Hamza
Ameer Hamza 2020년 11월 15일
I am glad to be of help!!!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Antennas, Microphones, and Sonar Transducers에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by