Why the Surf function is not working?

조회 수: 12 (최근 30일)
chaos B
chaos B 2020년 1월 15일
댓글: chaos B 2020년 1월 15일
I have this function i am trying to plot but its not working. In fact, every time i try to use ' surf ' it does not work... i get the same error.
this is a code example
[x,y] = meshgrid(-2:.2:2);
g = x .* exp(-x.^2 - y.^2);
surf(x, y, g)
and this is the error i get every time i try to graph 3d using surf
Undefined function or variable 'xerror'.
Error in surf (line 71)
xerror(surfchk(dataargs{:}));
This is line 71 in surf : xerror(surfchk(dataargs{:}));
Any ideas anyone?

채택된 답변

Walter Roberson
Walter Roberson 2020년 1월 15일
At some point you had the code for surf open and accidentally inserted a character into the code. You need to go back and delete the x from that line of code.
  댓글 수: 1
chaos B
chaos B 2020년 1월 15일
Indeed Mr. Walter, i had an accidental x(first x) in line 71. i removed it and the code worked perfectly! Many Thanks!!

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

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by