フィルターのクリア

2D colormap of a polar coordinates function

8 ビュー (過去 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 Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by