Error using contour function
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tallha Khan
am 3 Jan. 2018
Beantwortet: Star Strider
am 3 Jan. 2018
When attempting to produce a contour plot of an equation i have named as Z. I am presented with the error shown below.
Can anyone help?

0 Kommentare
Akzeptierte Antwort
Star Strider
am 3 Jan. 2018
You need to use ‘X’ and ‘Y’ in ‘Z’.
Try this:
x = linspace(-1, 1, 100);
y = linspace(-1, 1, 100);
[X,Y] = meshgrid(x, y);
a = x + 0.5;
b = y - 0.5;
Z = @(x,y) 1./sqrt(a.^2 + y.^2) - 2./sqrt(b.^2 + x.^2);
figure(1)
contour(X, Y, Z(X,Y))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Contour Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!