资源简介
用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*
相关资源
-
Fuzzysimuli
nk有关模糊PID问题概述-自适 - matlab开发-能带计算
- matlab开发-FlockingAlgorithm
- KF+EKF matlab程序实现
- Matlab多元统计分析程序
- matlab实现电力系统潮流计算-PQ分解法
- matlab读取SP3文件
- 内弹道计算
- 相关向量机的快速算法
- 基于MATLAB的OFDM系统仿真及分析
- 基于MATLAB的液压伺服控制系统分析与
- MATLAB7.x图像处理
- 灰度共生矩阵matlab
- 实用化工计算机模拟--MATLAB在化学工程
- MATLAB电机仿真精华50例源代码.zip
- 水和水蒸气热力性质计算程序代码m
- MATLAB课设学生成绩管理系统
- 清洁机器人路径规划matlab仿真程序
- MATLAB电机仿真精华50例源代码269078
- BP神经网络解决手写数字识别问题 m
- 基于倒谱图判断浊音的基音周期MATL
- 图像的饱和度,亮度,色调的matlab代
- 肤色检测matlab代码
- SRC的程序,matlab的,很有用处
- 粒子群算法优化pid源码 matlab仿真.ra
- ChinaMap.rar
- MATLAB控制工程工具箱技术手册
- 圆拟合matlab程序,以及圆心 半径的确
- stlwritematlab程序
- 系数绝对值最大 图像融合MATLAB算法
评论
共有 条评论