File:Bump2D illustration.png
来自testwiki
跳转到导航
跳转到搜索
本预览的尺寸:800 × 492像素。 其他分辨率:320 × 197像素 | 640 × 393像素 | 1,024 × 629像素 | 1,604 × 986像素。
原始文件 (1,604 × 986像素,文件大小:179 KB,MIME类型:image/png)
本文件来自维基共享资源并可能被其他项目使用。 其文件描述页上的描述显示在下面。
摘要
| 描述Bump2D illustration.png | A bump function in 2D |
| 日期 | |
| 来源 | 自己的作品 |
| 作者 | Oleg Alexandrov |
| PNG开发 InfoField | |
| 源代码 InfoField | MATLAB code% illustration of a bump function in two dimensions
function main()
% the number of data points. More points means prettier picture.
N = 300;
% a function close to what we want, but not smooth
Z = get_step_function (N);
% a smooth function with small support, that will serve as mollifier
W = get_mollifier (N);
% get the convolution of the two, so a mollified step function
S = conv2(Z, W);
% truncate S at the edges, and scale it
p=0.2;
[m, n] = size(S);
m1 = floor(p*m)+1; m2=floor((1-p)*m)-1;
n1 = floor(p*n)+1; n2=floor((1-p)*n)-1;
S = S(m1:m2, n1:n2);
S = 100*S/max(max(S));
% plot the surface
figure(2); clf; hold on; axis equal; axis off;
surf(S);
% make the surface beautiful
shading interp;
colormap autumn;
% add in a source of light
camlight (-50, 54);
% viewing angle
view(-40, 38);
% save as png
print('-dpng', '-r400', 'Bump2D_illustration_uncropped.png');
% optionally, crop the margins
!convert -trim Bump2D_illustration_uncropped.png Bump2D_illustration.png
% get a function which is 1 on a set, and 0 outside of it
function Z = get_step_function(N)
XX = linspace(-1.5, 4, N);
YY = linspace(-4, 4, N);
[X, Y] = meshgrid(XX, YY);
c = 2;
k=1.2;
shift=10;
Z = (c^2-X.^2-Y.^2).^2 + k*(c-X).^3-shift;
Z =1-max(sign(Z), 0);
function W = get_mollifier(N)
% now try to get a function with compact support
% as a mollifier
% We will cheat by using a gaussian
a = 4;
XX = linspace(-a, a, N);
YY = linspace(-a, a, N);
[X, Y] = meshgrid(XX, YY);
K = 4;
W = exp(-K*(X.^2+Y.^2));
% truncate the Gaussian to make it with compact support
trunc = 1e-2;
W = max(W-trunc, 0);
|
许可协议
| Public domainPublic domainfalsefalse |
| 我,本作品著作权人,释出本作品至公有领域。这适用于全世界。 在一些国家这可能不合法;如果是这样的话,那么: 我无条件地授予任何人以任何目的使用本作品的权利,除非这些条件是法律规定所必需的。 |
说明
添加一行文字以描述该文件所表现的内容
此文件中描述的项目
描繪內容
某些值没有维基数据项目
著作权持有者释出至公有领域 简体中文(已转写)
8 8 2007
image/png
183,286 字节
986 像素
1,604 像素
文件历史
点击某个日期/时间查看对应时刻的文件。
| 日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
|---|---|---|---|---|---|
| 当前 | 2007年8月8日 (三) 04:15 | 1,604 × 986(179 KB) | wikimediacommons>Oleg Alexandrov | Trying to fix some odd issues with the bounding box. |
文件用途
以下页面使用本文件: