164
7 • Formulation des éléments finis
% Conditions aux limites
ddlfixe(1) = 1 ; valfixe(1) = 0. ;
ddlfixe(2) = 2 ; valfixe(2) = 0. ;
% Declaration de K et F
vecforce = zeros(ntotdof,1) ;
kglobal = zeros(ntotdof,ntotdof) ;
% Chargement
vecforce(ntotdof-1) = 1.e3 ; % [N]
% Construction de la matrice de raideur globale
for iel=1:nel
% Definition de la matrice de raideur locale
klocal = [12.*E*I/l^3 6.*E*I/l^2
-12.*E*I/l^3 6.*E*I/l^2;
6.*E*I/l^2 4.*E*I/l -6.*E*I/l^2 2.*E*I/l;
-12.*E*I/l^3 -6.*E*I/l^2 12.*E*I/l^3
-6.*E*I/l^2;
6.*E*I/l^2 2.*E*I/l -6.*E*I/l^2 4.*E*I/l];
% Assemblage de la matrice globale
for idof=1:2*ndof
for jdof=1:2*ndof
igl = ndof*(iel-1)+idof ;
jgl = ndof*(iel-1)+jdof ;
kglobal(igl,jgl) = kglobal(igl,jgl)
+ klocal(idof,jdof) ;
end
end
end
% Prise en compte des conditions aux limites
for idof=1:length(ddlfixe)
Précédent

- 173/226

Suivant