% Aufgabe 32-11, Matlab-Femset (n Elemente)
clear all

L1 = 0.4 ;  EI1   = 3000 ;  c1 = 120000 ;  m1 =  8 ;
L2 = 0.3 ;  EI2   = 4000 ;  c2 =  70000 ;  m2 = 10 ;
L3 = 0.5 ;  rhoA1 =  2.4 ;  cT =   6000 ;
L4 = 0.6 ;  rhoA2 =  3.2 ;

Lges = L1+L2+L3+L4 ;

n   = 18 ;                                           % Anzahl der Elemente 
ic1 = round (n*L1/Lges+1) ;                          % Markante Punkte
im1 = round (n*(L1+L2)/Lges+1) ;
icT = round (n*(L1+L2+L3)/Lges+1) ;
im2 = n+1 ;

xy = (0 : Lges/n : Lges)' ;
for i=1:n
    km(i,:) = [ i  i+1] ;                            % Koinzidenzmatrix
    if i <im1  ep(i,:) = [EI1 rhoA1] ;               % Elementparameter
    else       ep(i,:) = [EI2 rhoA2] ;   
    end
end
kr = zeros (n+1,2) ;                                 % Matrix der Randbedingungen
kr(  1,:) = [1 1]  ;                                
kr(icT,:) = [1 0]  ;                                
mk = zeros (n+1,2) ;                                 % Matrix der Knotenmassen
mk(im1,1) = m1 ;                                     
mk(im2,1) = m2 ;                                     
sc = zeros (n+1,2) ;                                 % Matrix der Federsteifigkeiten
sc(ic1,1) = 2*c1 ;
sc(icT,2) = cT   ;
sc(im2,1) = 2*c2 ;

% Finite-Elemente-Algorithmus:
[nc omega x] = femeig_m (3 , xy , km , ep , kr , mk , sc) ; % 3 Eigenkreisfrequenzen
if nc > 0
    f = omega/(2*pi)                                 % Frequenzen -> Command Window
    draweigvecs (xy , km , kr , x) ;                 % Schwingungsformen zeichnen
end