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

6 visualizaciones (últimos 30 días)
geometry geometry
geometry geometry el 13 de Mayo de 2017
Comentada: Steven Lord el 13 de Mayo de 2017
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.

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 13 de Mayo de 2017
Your typo
Should be:
contour(X,Y,f(X,Y));
  2 comentarios
geometry geometry
geometry geometry el 13 de Mayo de 2017
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 el 13 de Mayo de 2017
Use the figure function to open a new figure window, or use subplot to create two or more separate axes in one figure window.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by