声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3864|回复: 4

[综合讨论] 《结构分析的有限元法与MATLAB程序设计》中程序哪里找啊

[复制链接]
发表于 2007-5-27 10:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
徐老师在书中提到书中附有程序,但是书中没有找到啊,有人知道在哪里找么?多谢!
回复
分享到:

使用道具 举报

发表于 2007-6-13 20:37 | 显示全部楼层
可以发邮件给他,索取程序
发表于 2009-10-31 19:25 | 显示全部楼层

邮件?

请问徐老师邮件地址呢,可否通告
发表于 2013-4-10 18:59 | 显示全部楼层
本帖最后由 ME! 于 2013-4-10 19:03 编辑

附件所示:因为不支持压缩文件格式,无法一一上传
  1. %--------------------------------------------------------------------------
  2. % Example 5.4.5
  3. %   To solve the eigenvalue problem for a beam structure.
  4. %   using Euler Bernoulli beam or Timoshenko beam elements.
  5. %   nodal dofs: {v1  1   v2   2}
  6. % Problem description
  7. %   Find the natural frequencies and modal shapes of a simply supported beam whose length
  8. %   is 1 m. The beam has elastic modulus of 2.1x10^11 and its cross-section is 0.02 m height
  9. %   by 0.02 m width. The mass density is 7860 kg/m^3. A concentrated load of -500 N is
  10. %   applied at the middle of the beam.
  11. % Variable descriptions
  12. %   k, m - element stiffness matrix and element mass matrix
  13. %   kk, mm - system stiffness matrix and system mass matrix
  14. %   ff - system force vector
  15. %   index - a vector containing system dofs associated with each element
  16. %   bcdof - a vector containing dofs associated with boundary conditions
  17. %   bcval - a vector containing boundary condition values associated with the dofs in bcdof
  18. %--------------------------------------------------------------------------
  19. %  (0) input data
  20. %--------------------------------------------------------------------------
  21. clear; clc;

  22. %Beam_InputData541;                     % import the input data for the information of
  23.                                   % nodes, elements, loads, constraints and materials
  24. Opt_beam=1;                                       % option for type of the beam:
  25.                                                     % =1 Euler Bernoulli beam
  26.                                                     % =2 Timoshenko beam
  27. Opt_mass=1;                                            % option for mass matrix:
  28.                                                     % =1 consistent mass matrix
  29.                                                     % =2 lumped mass matrix
  30. Opt_graphics1=0;                       % option for graphics of the nodal connectivity
  31. Opt_graphics3=1;                            % option for graphics of the modal shape

  32. ith=1;                                        % select the order of modes to display






  33. % -------------------------------------------------------------------------
  34. % Input data for static analysis of beam structure (Example 5.4.1)
  35. % -------------------------------------------------------------------------
  36. %  (0.1) input basic data
  37. % -------------------------------------------------------------------------
  38. Prob_title='static analysis of beam structure';

  39. No_el=40;                                                 % number of elements
  40. No_nel=2;                                         % number of nodes per element
  41. No_dof=2;                                             % number of dofs per node
  42. No_node=(No_nel-1)*No_el+1;                      % total number of nodes in system
  43. Sys_dof=No_node*No_dof;                                     % total system dofs
  44. %--------------------------------------------------------------------------
  45. %  (0.2) physical and geometric properties
  46. %--------------------------------------------------------------------------
  47. prop(1)=2.1e11;                                               % elastic modulus
  48. prop(2)=0.3;                                                   % Poisson's ratio
  49. prop(3)=7860;                                % mass density (mass per unit volume)
  50. prop(4)=0.02;                            % height of beam cross-section in y direction
  51. prop(5)=0.02;                             % width of beam cross-section in z direction
  52. prop(6)=0.02*0.02;                                % cross-sectional area of the beam
  53. prop(7)=0.02*0.02^3/12;                % moment of inertia of cross-section about axis y
  54. prop(8)=0.02*0.02^3/12;                % moment of inertia of cross-section about axis z
  55. %--------------------------------------------------------------------------
  56. %  (0.3) nodal coordinates
  57. %--------------------------------------------------------------------------
  58.                                     % x, y, z coordinates in global coordinate system
  59. xx=zeros(No_node,1); yy=zeros(No_node,1); zz=zeros(No_node,1);
  60. dx=0.025;
  61. xx=0:dx:(No_node-1)*dx; xx=xx';
  62. gcoord=[xx  yy  zz];
  63. %--------------------------------------------------------------------------
  64. %  (0.4) applied load
  65. %--------------------------------------------------------------------------

  66. P=[-500,21,1];                        % load applied at node 21 in the negative y direction

  67. %--------------------------------------------------------------------------
  68. %  (0.5) boundary conditions
  69. %--------------------------------------------------------------------------
  70. ConNode=[ 1, 1, 0;...                                  % code for constrained nodes
  71.          41, 1, 0];
  72. ConVal =[ 1, 0, 0;...                                    % values at constrained dofs
  73.          41, 0, 0];
  74. %--------------------------------------------------------------------------
  75. %     The end
  76. % -------------------------------------------------------------------------



  77. %--------------------------------------------------------------------------
  78. %  (1) initialization of matrices and vectors to zero
  79. %--------------------------------------------------------------------------
  80. k=zeros(No_nel*No_dof,No_nel*No_dof);                   % element stiffness matrix
  81. m=zeros(No_nel*No_dof,No_nel*No_dof);                     % element mass matrix

  82. kk=zeros(Sys_dof,Sys_dof);                   % initialization of system stiffness matrix
  83. mm=zeros(Sys_dof,Sys_dof);                     % initialization of system mass matrix
  84. ff=zeros(Sys_dof,1);                            % initialization of system force vector

  85. index=zeros(No_nel*No_dof,1);                        % initialization of index vector

  86. bcdof=zeros(Sys_dof,1);                               % initializing the vector bcdof
  87. bcval=zeros(Sys_dof,1);                                % initializing the vector bcval
  88. %--------------------------------------------------------------------------
  89. %  (2) calculation of constraints
  90. %--------------------------------------------------------------------------
  91. [n1,n2]=size(ConNode);
  92.                                                  % calculate the constrained dofs
  93. for ni=1:n1
  94.   ki=ConNode(ni,1);
  95.   bcdof((ki-1)*No_dof+1:ki*No_dof)=ConNode(ni,2:No_dof+1);
  96.                                                   % the code for constrained dofs
  97.   bcval((ki-1)*No_dof+1:ki*No_dof)=ConVal(ni,2:No_dof+1);
  98.                                                   % the value at constrained dofs
  99. end
  100. %--------------------------------------------------------------------------
  101. %  (3) applied nodal loads
  102. %--------------------------------------------------------------------------

  103. ff(No_dof*(P(2)-1)+P(3))=P(1);

  104. %--------------------------------------------------------------------------
  105. %  (4) calculate the element matrices and assembling
  106. %--------------------------------------------------------------------------
  107. for iel=1:No_el                               % loop for the total number of elements
  108.   nd(1)=iel;                                 % 1st node number of the iel-th element
  109.   nd(2)=iel+1;                              % 2nd node number of the iel-th element
  110.   x(1)=gcoord(nd(1),1); y(1)=gcoord(nd(1),2); z(1)=gcoord(nd(1),3);
  111.                                                        % coordinates of 1st node
  112.   x(2)=gcoord(nd(2),1); y(2)=gcoord(nd(2),2); z(2)=gcoord(nd(2),3);
  113.                                                       % coordinates of 2nd node
  114.   leng=sqrt((x(2)-x(1))^2+(y(2)-y(1))^2+(z(2)-z(1))^2);
  115.                                                         % length of element 'iel'
  116.   if Opt_beam==1
  117.     [k,m]=BeamElement11(prop,leng,Opt_mass);
  118.                                % compute element matrices for Euler-Bernoulli beam
  119.   else
  120.     [k,m]=BeamElement12(prop,leng,Opt_mass);
  121.                                   % compute element matrices for Timoshenko beam
  122.   end

  123.   index=femEldof(nd,No_nel,No_dof);      % extract system dofs associated with element

  124.   kk=femAssemble1(kk,k,index);                   % assemble system stiffness matrix
  125.   mm=femAssemble1(mm,m,index);                   % assemble system mass matrix
  126. end
  127. %--------------------------------------------------------------------------
  128. %  (5) apply constraints and solve the matrix equation
  129. %--------------------------------------------------------------------------
  130. [kk0,mm0,ff0,bcdof0,bcval0,sdof0]=kkCheck1(kk,mm,ff,bcdof,bcval); % 检查总体刚度矩阵kk的主元是否为0                                   

  131. [kk,mm,ff]=femApplybc1(kk,mm,ff,bcdof,bcval);% 施加边界条件
  132.                                  
  133.                                 
  134. [kk2,mm2,ff2,sdof2]=bcCheck1(kk0,mm0,ff0,bcdof0); % 检查边界条件,消去相应的自由度
  135.                               % and columns associated with the boundary conditions
  136. [V,D]=eig(kk2,mm2);                        % solve the eigenvalue problem of matrix
  137. [lambda,ki]=sort(diag(D));                      % sort the eigenvaules and eigenvectors
  138. omega=sqrt(lambda);                             % the frequency vector in radon/sec.
  139. omega1=sqrt(lambda)/(2*pi);                            % the frequency vector in Hz.
  140. V=V(:,ki);                                                   % the modal matrix
  141. %--------------------------------------------------------------------------
  142. %  (6) Analytical solution
  143. %--------------------------------------------------------------------------
  144. E=prop(1); Iz=prop(8); rho=prop(3)*prop(6); L=1;
  145. i=(1:sdof2)';
  146. omega2=i.*i*pi^2*sqrt(E*Iz/(rho*L^4));
  147. omega3=omega2/(2*pi);
  148. %--------------------------------------------------------------------------
  149. %  (7) graphics of nodal connectivity and static deformation
  150. %--------------------------------------------------------------------------
  151. %---------------------------------
  152. %  (7.1) display the nodal connectivity
  153. %---------------------------------
  154. if Opt_graphics1==1
  155.   for iel=1:No_el                             % loop for the total number of elements
  156.     nd(1)=iel;                               % 1st node number of the iel-th element
  157.     nd(2)=iel+1;                            % 2nd node number of the iel-th element
  158.     x(1)=gcoord(nd(1),1); y(1)=gcoord(nd(1),2); z(1)=gcoord(nd(1),3);
  159.                                                        % coordinates of 1st node
  160.     x(2)=gcoord(nd(2),1); y(2)=gcoord(nd(2),2); z(2)=gcoord(nd(2),3);
  161.                                                       % coordinates of 2nd node
  162.     figure(1)
  163.       plot(x,y); xlabel('x'), ylabel('y'), hold on;
  164.       axis([-0.1,1.1,-1.5,1.5]);
  165.       title('nodal connectivity of elements');
  166.   end
  167.   hold off
  168. end
  169. %--------------------------------------------------------------------------
  170. %  (7.3) draw the modal shape
  171. %--------------------------------------------------------------------------
  172. if Opt_graphics3==1
  173.   jk=ith; Vi=[V(:,jk)];                          % chose the order of modes to display
  174.   ik=0;                        % initial the counter for locating the modal coordinates

  175.   for ii=1:sdof0                                 % loop for the total number of sdof
  176.     if bcdof0(ii)==0
  177.       mcoord(ii,1)=Vi(ii-ik);
  178.     else
  179.       mcoord(ii,1)=0;
  180.       ik=ik+1;
  181.     end
  182.   end

  183.   for ii=1:No_node                              % loop for the total number of nodes
  184.     for ij=1:No_dof
  185.       mcoordA(ii,ij)=mcoord((ii-1)*No_dof+ij,1);
  186.     end
  187.   end

  188.   nv=20;

  189.   for i=1:nv+1
  190.     t=(i-1)*(2*pi)/20;
  191.     mcoordB=gcoord+[zeros(No_node,1),mcoordA(:,1),zeros(No_node,1)]*cos(t);
  192.     for iel=1:No_el                            % loop for the total number of elements
  193.       nd(1)=iel;                              % starting node number for element 'iel'
  194.       nd(2)=iel+1;                            % ending node number for element 'iel'
  195.       x(1)=mcoordB(nd(1),1); y(1)=mcoordB(nd(1),2); z(1)=mcoordB(nd(1),3);
  196.                                                         % coordinate of 1st node
  197.       x(2)=mcoordB(nd(2),1); y(2)=mcoordB(nd(2),2); z(2)=mcoordB(nd(2),3);
  198.                                                        % coordinate of 2nd node
  199.       figure(2)
  200.         plot(x,y,'b'), xlabel('x'), ylabel('y'), hold on;
  201.          axis([-0.1,1.1,-1.5,1.5])
  202.         title([num2str(jk), 'th modal shape of the structure']);
  203.     end
  204.     hold off
  205.     M(:,i)=getframe;
  206.   end
  207. movie(M,5,10);
  208. end
  209. %--------------------------------------------------------------------------
  210. %  (8) print fem solutions
  211. %--------------------------------------------------------------------------
  212. disp('The calculation is use of:')

  213. if Opt_beam==1
  214.   disp('Euler-Bernoulli beam element')
  215. else
  216.   disp('Timoshenko beam element')
  217. end

  218. if Opt_mass==1
  219.   disp('and consistent mass matrix')
  220. elseif Opt_mass==2
  221.   disp('and lumped mass matrix')
  222. end

  223. disp(' ')
  224. disp('     mode   numrical   analytical')

  225. num=1:1:10;                                           % print natural frequencies
  226. frequency=[num' omega1(1:10)  omega3(1:10)]
  227. %--------------------------------------------------------------------------
  228. %     The end
  229. % -------------------------------------------------------------------------
复制代码
发表于 2014-7-7 15:22 | 显示全部楼层
其他的程序 电子版有找到么
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-14 22:46 , Processed in 0.053748 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表