# MATLAB PDE工具箱简单教程

PDE 即 Partial Differential Equations

静电学、静磁学、交流电源电磁学、直流导电介质、热传导、扩散

下文按照这行按钮的顺序解释用法

界面如上图

附上一段代码：

% This script is written and read by pdetool and should NOT be edited.
% There are two recommended alternatives:
% 1) Export the required variables from pdetool and create a MATLAB script
%    to perform operations on these.
% 2) Define the problem completely using a MATLAB script. See
%    https://www.mathworks.com/help/pde/examples.html for examples
%    of this approach.
clear;
clc;

[pde_fig,ax]=pdeinit;
pdetool('appl_cb',9);
set(ax,'DataAspectRatio',[1 142.85714285714286 1]);
set(ax,'PlotBoxAspectRatio',[1.5000000000000004 1 142.85714285714286]);
set(ax,'XLim',[-0.001 0.02]);
set(ax,'YLim',[-0.5 1.5]);
set(ax,'XTickMode','auto');
set(ax,'YTickMode','auto');

thickness = 0.0207;
second_pos = 0.0006 + thickness;
third_pos = second_pos + 0.0036;
fourth_pos = third_pos + 0.0055;

% Geometry description:
pderect([0 0.0006 1 0],'R1');
pderect([0.0006 second_pos 1 0],'R2');
pderect([second_pos third_pos 1 0],'R3');
pderect([third_pos fourth_pos 1 0],'R4');
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R1+R2+R3+R4');

% Boundary conditions:
pdetool('changemode',0);
pdesetbd(12,...
'dir',...
1,...
'0',...
'0');
pdesetbd(11,...
'dir',...
1,...
'0',...
'0');
pdesetbd(10,...
'dir',...
1,...
'0',...
'0');
pdesetbd(9,...
'dir',...
1,...
'0',...
'0');
pdesetbd(8,...
'dir',...
1,...
'0',...
'0');
pdesetbd(7,...
'dir',...
1,...
'0',...
'0');
pdesetbd(6,...
'dir',...
1,...
'0',...
'0');
pdesetbd(5,...
'dir',...
1,...
'0',...
'0');
pdesetbd(2,...
'neu',...
1,...
'8.36',...
'309.32');
pdesetbd(1,...
'dir',...
1,...
'1',...
'65');

% Mesh generation:
setappdata(pde_fig,'refinemethod','regular');
setappdata(pde_fig,'jiggle',char('on','mean',''));
setappdata(pde_fig,'MesherVersion','preR2013a');
pdetool('initmesh');

% PDE coefficients:
pdeseteq(2,...
'0.082!0.028!0.37!0.045',...
'0!0!0!0',...
'(1)+(0).*(65)!(0)+(0).*(37)!(0)+(0).*(30)!(0)+(0).*(37)',...
'(300).*(1377)!(1.18).*(1005)!(862).*(2100)!(74.2).*(1726)',...
'0:3600',...
'37',...
'0.0',...
'[0 100]');
setappdata(pde_fig,'currparam',...
['300!1.18!862!74.2     ';...
'1377!1005!2100!1726   ';...
'0.082!0.028!0.37!0.045';...
'1!0!0!0               ';...
'0!0!0!0               ';...
'65!37!37!37           ']);

% Solve parameters:
setappdata(pde_fig,'solveparam',...
'0.5','longest','0','1E-4','','fixed','Inf'));

% Plotflags and user data strings:
setappdata(pde_fig,'plotflags',[1 1 1 1 1 1 6 1 0 0 0 5401 1 0 0 0 0 1]);
setappdata(pde_fig,'colstring','');
setappdata(pde_fig,'arrowstring','');
setappdata(pde_fig,'deformstring','');
setappdata(pde_fig,'heightstring','');

% Solve PDE:
pdetool('solve');
pdetool('export', 5);


posted @ 2021-07-27 11:08  AWordThatWeDefine  阅读(1231)  评论(1编辑  收藏  举报