📄 circle_area.m
字号:
exact_area =pi*25^2;
errors = []
mesh_sizes = [32, 16, 8, 4, 2];
for mesh_size = mesh_sizes
[fens,gcells,groups,edge_gcells,edge_groups]=targe2_mesher({...
'curve 1 circle Center 13 4.2 radius 25',...
'subregion 1 property 1 boundary 1',...
['m-ctl-point constant ' num2str(mesh_size)]
}, 1.0);
drawmesh({fens,gcells},'gcells','shrink', 1.0);
view(2)
geom = field(struct ('name',['geom'], 'dim', 2, 'fens',fens));
feb = feblock (struct ('mater',[], 'gcells',gcells,...
'integration_rule', tri_rule (1)));
approximate_area =measure(feb,geom,inline('x(2)','x'));
errors = [errors abs(exact_area-approximate_area)]
disp([' The area is = ' num2str(approximate_area) ', to be compared with ' num2str(exact_area)])
pause(1); close all
end
loglog(mesh_sizes, errors, 'bo-'); grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -