
2D colormap of a polar coordinates function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Matthew Barber
le 6 Déc 2020
Commenté : Ameer Hamza
le 6 Déc 2020
I have a function defined as:
which I can visualise in 1D using:
r = -2:0.001:2;
a1 = 5;
I = a1 * exp(-2*(r).^2);
plot(r,I);
However, this function is radially symmetric, so I should be able to plot it in 2D and make it look like this:

How could I do this? I would like it to remain a plot of r (on the horizontal axes) against I(r).
0 commentaires
Réponse acceptée
Ameer Hamza
le 6 Déc 2020
Modifié(e) : Ameer Hamza
le 6 Déc 2020
You will need to use
x = -2:0.02:2;
[x,y] = meshgrid(x);
a1 = 5;
r2 = x.^2+y.^2;
I = a1 * exp(-5*r2);
surf(x,y,I);
shading interp
colormap(jet)

3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polar 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!