Borrar filtros
Borrar filtros

I got error in plotting

1 visualización (últimos 30 días)
Habib
Habib el 25 de Jun. de 2016
Editada: Walter Roberson el 25 de Jun. de 2016
Hi everyone,
I tried to plot a figure by contour command and after I defined a set command for make changing on K values but ,when I run it, I got a figure that is not my preferred shape. of course, if I defined "set" function as set(d,'levelstep',30); , I got a right figure and, at this time, below error has occurred.
Undefined function or variable 'k'.
Error in projetmatlab (line 10)
set(k,'levelstep',30);
my code is as follow:
close all
clear
clc
x=linspace(-4,4,200);
y=x;
[X, Y]=meshgrid(x,y);
V=1./sqrt((X-1).^2+(Y).^2+eps)-1./sqrt((X+1).^2+Y.^2+eps);
[Ex, Ey]=gradient(V);
[C, K]=contour(X,Y,V,[-2:0.1:2]);
set(k,'levelstep',30);
[C1, h]=contour(X,Y,sqrt(Ex.^2+Ey.^2),[0:0.01:0.5]);
so what is wrong?

Respuesta aceptada

KSSV
KSSV el 25 de Jun. de 2016
Editada: KSSV el 25 de Jun. de 2016
close all
clear
clc
x=linspace(-4,4,200);
y=x;
[X, Y]=meshgrid(x,y);
V=1./sqrt((X-1).^2+(Y).^2+eps)-1./sqrt((X+1).^2+Y.^2+eps);
[Ex, Ey]=gradient(V);
[C, K]=contour(X,Y,V,[-2:0.1:2]);
set(K,'levelstep',30);
[C1, h]=contour(X,Y,sqrt(Ex.^2+Ey.^2),[0:0.01:0.5]);
In the set command it shall be 'K' (capital), you typed 'k' (small case)

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by