function pdemodel
[pde_fig,ax]=pdeinit
pdetool('appl_cb',1)
set(ax,'DataAspectRatio',[1 6.5 1])
set(ax,'PlotBoxAspectRatio',[15 10 1])
set(ax,'XLim',[-15 15])
set(ax,'YLim',[-10 120])
set(ax,'XTickMode','auto')
set(ax,'YTickMode','auto')
% Geometry description:
pderect([0 1 100 0],'R1')
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R1')
% Boundary conditions:
pdetool('changemode',0)
pdesetbd(4,'neu',1,'0','0')
pdesetbd(3,'dir',1,'1','0')
pdesetbd(2,'neu',1,'0','0')
pdesetbd(1,'dir',1,'1','100')
% Mesh generation:
setuprop(pde_fig,'Hgrad',1.3)
setuprop(pde_fig,'refinemethod','regular')
pdetool('initmesh')
pdetool('refine'宽扒)
pdetool('refine')
pdetool('refine')
pdetool('refine')
% PDE coefficients:
pdeseteq(1,'1.0','0.0','0','1.0','0:10','0.0','0.0','[0 100]')
setuprop(pde_fig,'currparam',['1.0''0.0''0 ''1.0'])
% Solve parameters:
setuprop(pde_fig,'solveparam',...
str2mat('0','18432','10','pdeadworst',...
'0.5'慎唯昌,'longest','0','1E-4','','fixed'山唯,'Inf'))
% Plotflags and user data strings:
setuprop(pde_fig,'plotflags',[1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 1])
setuprop(pde_fig,'colstring','')
setuprop(pde_fig,'arrowstring','')
setuprop(pde_fig,'deformstring','')
setuprop(pde_fig,'heightstring','')
% Solve PDE:
pdetool('solve')
%%clc
clear
m = linspace(1,100,100)
flag = 0
res = 0
for i = 3:length(m)
for j = 2:i-1
if mod(m(i),j) == 0
flag = 1
break
else
flag = 0
end
end
if flag == 0
r = [res,m(i)]
res = r
end
end
r(2:length(r))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)