2D colormap of a polar coordinates function

조회 수: 3 (최근 30일)
Matthew Barber
Matthew Barber 2020년 12월 6일
댓글: Ameer Hamza 2020년 12월 6일
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).

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 12월 6일
편집: Ameer Hamza 2020년 12월 6일
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
KALYAN ACHARJYA
KALYAN ACHARJYA 2020년 12월 6일
Thanks, you answered it exactly sir
Ameer Hamza
Ameer Hamza 2020년 12월 6일
I am glad to be of help! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by