Bar Matlab Prog PDF

Title Bar Matlab Prog
Author Yashwant Rajeshirke
Course B.e. (mechanical)
Institution Savitribai Phule Pune University
Pages 2
File Size 28.3 KB
File Type PDF
Total Downloads 66
Total Views 139

Summary

Matlab Program for FEM...


Description

clc % Clear command window clear all % Clearing the Workspace close all % Close all % Element specifications ne = 2; % No. of elements nne = ne+1; % No. of nodes per element nn = nne; % No. of elements = Number of nodes per elements ndof = 1; % No. of DOF per node Sg = nn*ndof; % Sg - size of global stiffness matrix Se = ne*ndof; % Se - size of elemental stiffness matrix Kg = zeros(Sg,Sg); % Kg - Global stiffness matrix Ke = zeros(Se,Se); % Ke - Elemental Stiffness Matrix Fg = zeros(Sg,1); % Fg Global Force Vector % Geometrical parameters E = 30e6*ones(1,ne); % Young's Modulus p = 0.2836*ones(1,ne); % density g = 10; % Accln due to gravity L = 24; % Length of Bar T = 1; % Thickness of Bar % Area of cross-section Le= L/ne; % length of each element Ar= (6*ones(1,nne) - ((3./24)*Le*linspace(0,ne,nne)))*T; % Area of each cross section for ai = 1:ne A(ai) = (Ar(ai)+Ar(ai+1))/2; % Average area of each element end % Length of each element for ie = 1:ne a(ie) = L/ne; end % Assembly of Global Stiffness Matrix for i = 1:ne % Elemental Stiffness Matrix and Force Matrix. Ke = E(i)*A(i)/a(i)*[1 -1;... -1 1]; Fe = (p(i)*A(i)*a(i)./2)*[1;1]; % Connection Matrix e = linspace(1,ne,ne); e1= transpose(e); f = linspace(2,ne+1,ne); f1= transpose(f); conn = horzcat(e1,f1); for j = 1:2 for k = 1:2 Kg(conn(i,j),conn(i,k)) = Kg(conn(i,j),conn(i,k)) + Ke(j,k); end Fg(conn(i,j),1) = Fg(conn(i,j),1) + Fe(j,1); end end % Concentred Load Vector at end

FgM = zeros(Sg,1); FgM(2,1) = 100; Fg(2,1) = Fg(2,1)+FgM(2,1); % Application of Boundary Condn. KgS = Kg; FgS = Fg; cdof = 1; for cd = cdof Kg(cd,:) = 0; Kg(:,cd) = 0; Kg(cd,cd) = 1; Fg(cd,1) = 0; end % Displacements after solving U = linsolve(Kg,Fg) % Reaction Forces FR = KgS*U - FgS...


Similar Free PDFs