필터 지우기
필터 지우기

Error using contour: Z must be at least a 2x2 matrix.

조회 수: 6 (최근 30일)
geometry geometry
geometry geometry 2017년 5월 13일
댓글: Steven Lord 2017년 5월 13일
What's the problem with the following code?
f=input('enter function: ','s');
f = str2func(['@(x,y)' vectorize(f)]);
[X,Y]=meshgrid(-10:.5:10);
contour(X,Y,f(x,y));
When I enter sin(x)+cos(y) the following error occurs:
Z must be at least a 2x2 matrix.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2017년 5월 13일
Your typo
Should be:
contour(X,Y,f(X,Y));
  댓글 수: 2
geometry geometry
geometry geometry 2017년 5월 13일
What a bad typo... thanks
is there a way to make two figures (two windows) in one code ?
for example one figure with mesh and the other with contour.
Steven Lord
Steven Lord 2017년 5월 13일
Use the figure function to open a new figure window, or use subplot to create two or more separate axes in one figure window.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by