I got error in plotting
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponse acceptée
KSSV
le 25 Juin 2016
Modifié(e) : KSSV
le 25 Juin 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)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Contour Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!