密度图中的伪影(Wolfram Mathematica)
我正在尝试使用密度平面图可视化Wolfram Mathematica中数值集成的结果。但是黑文伪像出现在图表上的圆圈内,这是不正确的。如何解决这个问题?
f[u_, v_]:=(1/1.2)*(1/(3.14159*0.02^2)*E^(-((x-u)^2+(y-v)^2)/0.02^2)+0.2/(3.14159*2^2)*E^(-((x-u)^2+(y-v)^2)/2^2));
i[x_, y_]:=NIntegrate[f[u, v],{u, v} \[Element] Disk[{0,0},2.5], AccuracyGoal -> 30];
DensityPlot[i[x, y], {x, -3, 3}, {y, -3, 3},ColorFunction->"SunsetColors",PlotPoints -> 20, PlotLegends -> Automatic]
链接到图像: https://postimg.cc/47mjtyj7
I am trying to visualize the result of numerical integration in Wolfram Mathematica using DensityPlot. But dark artifacts appear inside the circle on the graph, this is incorrect. How to fix this?
f[u_, v_]:=(1/1.2)*(1/(3.14159*0.02^2)*E^(-((x-u)^2+(y-v)^2)/0.02^2)+0.2/(3.14159*2^2)*E^(-((x-u)^2+(y-v)^2)/2^2));
i[x_, y_]:=NIntegrate[f[u, v],{u, v} \[Element] Disk[{0,0},2.5], AccuracyGoal -> 30];
DensityPlot[i[x, y], {x, -3, 3}, {y, -3, 3},ColorFunction->"SunsetColors",PlotPoints -> 20, PlotLegends -> Automatic]
Link to the image: https://postimg.cc/47MJTYj7
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,那不是人工制品,也不是。首先,我想指出
f
是u
,v
,x
和y 。因此,编程的方式不是很干净。现在解决主要问题。有两个高斯峰。一个非常宽,另一个非常锋利。在许多情况下,数值积分仅在尖峰附近获得点,因此无法检测到它。由于其余的平稳且容易,因此没有产生子集,并且积分只是缺少此贡献。幸运的是,有一个专门的选择。
minRecursion:nonstegrate可能会错过整数的尖峰:...
。因此,这可以工作花了很多时间。也许最好将其分为两个积分,然后对整合边界进行一些思考。
Well, that is not an artifact, or is it. First I'd like to point out that
f
is a function ofu
,v
,x
andy
. So the way it is programmed is not very clean. Now to the main problem. There are two Gaussian peaks. One is very broad, the other very sharp. In many cases the numerical integral just does not get points near the sharp peak, therefore not detecting it. As the rest is smooth and easy, no subset is generated and the integral is just missing this contribution. Luckily, there is an option specifically for this.MinRecursion: NIntegrate may miss sharp peaks of integrands:...
. So this worksTakes quite some time, though. Probably, it would be better to split this up in two integrals and invest some thought on the integration boundaries.