资源简介
用matlab写的有限元程序-FEM2DL_Box.m
本人是matlab初学者,在论坛下了不少资料,现在也做点贡献,分享几个有限元程序,给有需要的朋友。 虽然现在有大量的商用有限元程序,我自己就在用comsol在求解各种微分方程,商用程序有它的便利之处,但是用matlab自己学着编程序可以更好的把握求解的过程,对使用有限元方法计算的内部过程有更深的了解。还有一本电子书,讲的挺详细,一并传上了。
20090806174517671.jpg
本人是matlab初学者,在论坛下了不少资料,现在也做点贡献,分享几个有限元程序,给有需要的朋友。 虽然现在有大量的商用有限元程序,我自己就在用comsol在求解各种微分方程,商用程序有它的便利之处,但是用matlab自己学着编程序可以更好的把握求解的过程,对使用有限元方法计算的内部过程有更深的了解。还有一本电子书,讲的挺详细,一并传上了。
20090806174517671.jpg
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NAME OF FILE: FEM2DL_Box.m
%
% PURPOSE: This Matlab code solves a two-dimensional boundary-value problem
% using the finite element method. The boundary-value problem at hand
% corresponds to the Laplace‘s equation as applied to a rectangular domain
% characterized by a simple medium (isotropic linear and homogeneous)
% with dielectric constant epsr. The finite element method is based on sub-
% dividing the two-dimensional domain into Ne linear triangular elements.
% Dirichlet boundary conditions are applied to all four metallic walls:
%
% V=0 on the left sidewall
% V=0 on the right sidewall
% V=0 on the bottom sidewall
% V=V0 on the top wall which is separated by tiny gaps from the two sidewalls
%
% The dimensions of the domain are WxH where W=Width and H=Hight.
% The user has the freedom to modify any of the defined input variables
% including domain width and height (W & L) top wall voltage (V0) and number
% of bricks along the x- and y-axes. Note that each brick is then subdivided
% into two triangles.
%
% All quantities are expressed in the SI system of units.
%
% The Primary Unknown Quantity is the Electric Potential.
% The Secondary Unknown Quantity is the Electric Field.
%
% Written by Anastasis Polycarpou (Last updated: 8/12/2005)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear % Clear all variables
% Define Rectangular Geometry
% ===========================
W=1;
H=1;
% Define the number of bricks in the x and y directions
% =====================================================
XBRICKS=20;
YBRICKS=20;
% Define the Voltage (Electric potential) on the top wall
% =======================================================
V0=1;
% Generate the triangular mesh
% ============================
XLLC=0; % x-coordinate of the Lower Left Corner
YLLC=0; % y-coordinate of the Lower Left Corner
XURC=W; % x-coordinate of the Upper Right Corner
YURC=H; % y-coordinate of the Upper Right Corner
TBRICKS=XBRICKS*YBRICKS; % Total number of bricks
Dx=(XURC-XLLC)/XBRICKS; % Edge length along x-direction
Dy=(YURC-YLLC)/YBRICKS; % Edge length along y-direction
TNNDS=(XBRICKS+1)*(YBRICKS+1); % Total number of nodes
TNELMS=2*TBRICKS; % Total number of triangular elements
%
% Print the number of nodes and the number of elements
% ====================================================
fprintf(‘The number of nodes is: %6i\n‘TNNDS)
fprintf(‘The number of elements is: %6i\n‘TNELMS)
for I=1:TNNDS
X(I)=mod(I-1XBRICKS+1)*Dx;
Y(I)=floor((I-1)/(XBRICKS+1))*Dy;
end
% Connectivity Information
% ========================
for I=1:TBRICKS
ELMNOD(2*I-11)=I+floor((I-1)/XBRICKS);
ELMNOD(2*I-12)=ELMNOD(2*I-11)+1+(XBRICKS+1);
ELMNOD(2*I-13)=ELMNOD(2*I-11)+1+(XBRICKS+1)-1;
ELMNOD(2*I1)=I+floor((I-1)/XBRICKS);
ELMNOD(2*
相关资源
- 串行级联cpm系统MATLAB仿真
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
评论
共有 条评论