File:Numerical integration illustration, h=0.25.png
维基共享资源,媒体文件资料库
跳转到导航
跳转到搜索
本预览的尺寸:412 × 600像素。 其他分辨率:165 × 240像素 | 330 × 480像素 | 528 × 768像素 | 703 × 1,024像素 | 1,500 × 2,183像素。
原始文件 (1,500 × 2,183像素,文件大小:85 KB,MIME类型:image/png)
文件信息
结构化数据
说明
File:Numerical integration illustration step=0.25.svg是此文件的矢量版本。 如果此文件质量不低于原点阵图,就应该将这个PNG格式文件替换为此文件。
File:Numerical integration illustration, h=0.25.png → File:Numerical integration illustration step=0.25.svg
更多信息请参阅Help:SVG/zh。
|
摘要[编辑]
描述Numerical integration illustration, h=0.25.png | Illustration of Numerical ordinary differential equations |
来源 | 自己的作品 |
作者 | Oleg Alexandrov |
Public domainPublic domainfalsefalse |
我,本作品著作权人,释出本作品至公有领域。这适用于全世界。 在一些国家这可能不合法;如果是这样的话,那么: 我无条件地授予任何人以任何目的使用本作品的权利,除非这些条件是法律规定所必需的。 |
Source code (MATLAB)[编辑]
% illustration of numerical integration
% compare the Forward Euler method, which is globally O(h)
% with Midpoint method, which is globally O(h^2)
% and the exact solution
function main()
f = inline ('y', 't', 'y'); % will solve y' = f(t, y)
a=0; b=4; % endpoints of the interval where we will solve the ODE
N = 17; T = linspace(a, b, N); h = T(2)-T(1); % the grid
y0 = 1; % initial condition
% solve the ODE
Y_euler = solve_ODE (N, f, y0, h, T, 1); % Forward Euler method
Y_midpt = solve_ODE (N, f, y0, h, T, 2); % midpoint method
T_highres = a:0.1:b; Y_exact = exp(T_highres);
% prepare the plotting window
lw = 3; % curves linewidth
fs = 20; % font size
figure(1); clf; set(gca, 'fontsize', fs); hold on;
% colors
red=[0.867 0.06 0.14];
blue = [0, 129, 205]/256;
green = [0, 200, 70]/256;
% plot the solutions
plot(T, Y_euler, 'color', blue, 'linewidth', lw)
plot(T, Y_midpt, 'color', green, 'linewidth', lw)
plot(T_highres, Y_exact, 'color', red, 'linewidth', lw)
% axes aspect ratio
pbaspect([1 1.5 1]);
% save to disk
disp(sprintf('Grid size is %0.9g', h))
saveas(gcf, sprintf('Numerical_integration_illustration,_h=%0.2g.eps', h), 'psc2');
function Y = solve_ODE (N, f, y0, h, T, method)
Y = 0*T;
Y(1)=y0;
for i=1:(N-1)
t = T(i); y = Y(i);
if method == 1 % forward Euler method
Y(i+1) = y + h*f(t, y);
elseif method == 2 % explicit one step midpoint method
K = y + 0.5*h*f(t, y);
Y(i+1) = y + h*f(t+h/2, K);
else
disp ('Don`t know this type of method');
return;
end
end
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2007年5月25日 (五) 03:02 | 1,500 × 2,183(85 KB) | Oleg Alexandrov(留言 | 贡献) | Make exact solution smooth | |
2007年5月20日 (日) 05:00 | 1,500 × 2,183(84 KB) | Oleg Alexandrov(留言 | 贡献) | Higher resolution. Same license. | ||
2007年5月20日 (日) 03:19 | 375 × 546(16 KB) | Oleg Alexandrov(留言 | 贡献) | {{Information |Description=Illustration of Numerical ordinary differential equations |Source=self-made |Date= |Author= User:Oleg Alexandrov }} Category:Numerical analysis {{PD-self}} |
您不可以覆盖此文件。
文件用途
没有页面使用本文件。
全域文件用途
以下其他wiki使用此文件:
- ca.wikipedia.org上的用途
- el.wikipedia.org上的用途
- it.wikipedia.org上的用途
- mn.wikipedia.org上的用途
- pt.wikipedia.org上的用途
- tl.wikipedia.org上的用途
- uk.wikipedia.org上的用途
- zh.wikipedia.org上的用途