how to plot given exponential fn?

2 vues (au cours des 30 derniers jours)
Jayantra Thulasidas Andal
Jayantra Thulasidas Andal le 9 Déc 2020
Modifié(e) : Ameer Hamza le 9 Déc 2020
Plot the function f(x, y) = e(x^2+y^2-4*x)

Réponses (1)

Ameer Hamza
Ameer Hamza le 9 Déc 2020
Modifié(e) : Ameer Hamza le 9 Déc 2020
Several ways: mesh(), surf(), contoruf(), contour(), pcolor(), imagesc()
[X, Y] = meshgrid(linspace(-1, 1, 50));
Z = exp(X.^2+Y.^2-4*X);
f = figure();
subplot(2,2,1);
surf(X, Y, Z);
shading interp
subplot(2,2,2);
mesh(X, Y, Z);
subplot(2,2,3);
contourf(X, Y, Z, 10);
subplot(2,2,4);
pcolor(X, Y, Z);
shading interp
Or fsurf(), fmesh(), fcontourf()
fun = @(X, Y) exp(X.^2+Y.^2-4*X);
f = figure();
subplot(2,2,1);
fsurf(fun, [-1 1 -1 1]);
shading interp
subplot(2,2,2);
fmesh(fun, [-1 1 -1 1]);
subplot(2,2,3);
fcontour(fun, [-1 1 -1 1], 'Fill', 'on');
subplot(2,2,4);
fcontour(fun, [-1 1 -1 1]);

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by