Can I manipulate boundery conditions in the pdetoolbox

5 次查看(过去 30 天)
Hello, let´s say I specify with the pdetoolbox an elliptic (skalar) partial differential equation with only Dirichlet boundery conditions on a rectangle and plot it. 3 of the boundery conditions are h=1 and r=0 but the 4th is h=1 and r=5. If i save it i get following code created by the toolbox.
if true
% code function pdemodel
[pde_fig,ax]=pdeinit;
pdetool('appl_cb',1);
set(ax,'DataAspectRatio',[1 1 1]);
set(ax,'PlotBoxAspectRatio',[1.5 1 1]);
set(ax,'XLim',[-1.5 1.5]);
set(ax,'YLim',[-1 1]);
set(ax,'XTickMode','auto');
set(ax,'YTickMode','auto');
pdetool('gridon','on');
%
% Geometry description:
pderect([0 1 0.40000000000000002 0],'R1');
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R1')
%
% Boundary conditions:
pdetool('changemode',0)
pdesetbd(4,...
'dir',...
1,...
'1',...
'0')
pdesetbd(3,...
'dir',...
1,...
'1',...
'5') % <--------- hier manipulieren !!
pdesetbd(2,...
'dir',...
1,...
'1',...
'0')
pdesetbd(1,...
'dir',...
1,...
'1',...
'0')
%
% Mesh generation:
setappdata(pde_fig,'Hgrad',1.3);
setappdata(pde_fig,'refinemethod','regular');
setappdata(pde_fig,'jiggle',char('on','mean',''));
setappdata(pde_fig,'MesherVersion','preR2013a');
pdetool('initmesh')
%
% PDE coefficients:
pdeseteq(1,...
'1.0',...
'0.0',...
'10.0',...
'1.0',...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')
setappdata(pde_fig,'currparam',...
['1.0 ';...
'0.0 ';...
'10.0';...
'1.0 '])
%
% Solve parameters:
setappdata(pde_fig,'solveparam',...
char('0','1000','10','pdeadworst',...
'0.5','longest','0','1E-4','','fixed','Inf'))
%
% Plotflags and user data strings:
setappdata(pde_fig,'plotflags',[1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 0 1]);
setappdata(pde_fig,'colstring','');
setappdata(pde_fig,'arrowstring','');
setappdata(pde_fig,'deformstring','');
setappdata(pde_fig,'heightstring','');
%
% Solve PDE:
pdetool('solve')
end
Can I manipulate the code at "pdesetbd(3,'dir',1,'1','5')" where the arrow in the code is? For example can I include in the boundary condition a variable. Let´s say I want to include a variable called "Factor_1", where Factor_1 = 5 for example. In the code it would look like this now.
if true
%
% same code as in the top example
%
pdesetbd(3,...
'dir',...
1,...
'1',...
'5*Factor_1')
%
% same code as in the top example
%
end
Now the pdetoolbox should read the code, where the one boundary condition is now h=1 and r=5*Factor_1=25. I tried a few ways but it didn´t work. Is there even a way to do that?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by