在 MATLAB 中绘制贝塞尔函数

发布于 2024-08-31 11:40:15 字数 150 浏览 1 评论 0原文

在 MATLAB 中,如何绘制

f(r) = { 2*J1(a*r) / r }^2

其中 a = 2*pi J1 是第一类贝塞尔函数 r = sqrt(x^2 + y^2)

这应该以 3D 形式绘制,即有点像气泡(不知道如何做到这一点)

In MATLAB how do you plot

f(r) = { 2*J1(a*r) / r }^2

where a = 2*pi
and J1 is Bessel function of the 1st kind
and r = sqrt(x^2 + y^2)

This should plot in 3D, i.e. kind of be like a bubble (not sure how to do this)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红焚 2024-09-07 11:40:15

使用 besselj -- - 第一类贝塞尔函数---生成J1。我想你必须改变 ar 才能生成“气泡”。

我通过从 -1:0.01:1 改变 xy 并绘制网格点 (x,y,f ),不知道这是否是你想要的。

代码

a = 2*pi;
[X Y] = meshgrid(-1:0.01:1,-1:0.01:1);
R = sqrt(X.^2+Y.^2);
f = (2*besselj(1,a*R(:))./R(:)).^2;
mesh(X,Y,reshape(f,size(X)));
axis vis3d;

日志图

Doresdoom 建议,我用 set(gca,'Zscale','Log') 替换 axis vis3d;

alt text

网格

替代文字

Use besselj --- the Bessel function of first kind --- to generate J1. I suppose you have to vary a and r to generate the "bubble".

I generated the following by varying x and y from -1:0.01:1 and plotting meshing points (x,y,f), I don't know if this is what you want.

Code

a = 2*pi;
[X Y] = meshgrid(-1:0.01:1,-1:0.01:1);
R = sqrt(X.^2+Y.^2);
f = (2*besselj(1,a*R(:))./R(:)).^2;
mesh(X,Y,reshape(f,size(X)));
axis vis3d;

Log plot

Doresdoom suggestion, I replaced axis vis3d; with set(gca,'Zscale','Log').

alt text

Mesh

alt text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文