% Aufgabe 19-10a

clear all

a   = 500  ;
b   = 700  ;
EI1 = 6e9  ;
EI2 = 8e10 ;
M   = 800000 ;
c   = 800  ;
q   = 10   ;

A = [  0      0    0  1     0        0     0    0   ;
       0      0    1  0     0        0     0    0   ;
     a^3/6  a^2/2  a  1     0        0     0   -1   ;
     a^2/2    a    1  0     0        0    -1    0   ;
       a      1    0  0     0    -EI2/EI1  0    0   ;
      -1      0    0  0  EI2/EI1     0     0  c/EI1 ;
       0      0    0  0    -b       -1     0    0   ;
       0      0    0  0   b^3/6    b^2/2   b    1   ] ; 

B = [0 ; 0 ; 0 ;  0 ; 0 ; 0 ; (M+q*b^2/6)/EI2 ; -q*b^4/(120*EI2)] ;   

C = A \ B ;

n  = 1200 ;
z  = 0 : (a+b)/n : a+b ;
v  = zeros(n+1,1) ;
Mb = zeros(n+1,1) ;
FQ = zeros(n+1,1) ;

for i=1:n+1
   if z(i) <= a
       v(i)  = C(1)*z(i)^3/6+C(2)*z(i)^2/2+C(3)*z(i)+C(4) ;
       Mb(i) = -EI1*(C(1)*z(i)+C(2)) ;
       FQ(i) = -EI1*C(1) ;
   else
       z2    = z(i)-a ;
       v(i)  = q*z2^5/(120*EI2*b)+C(5)*z2^3/6+C(6)*z2^2/2+C(7)*z2+C(8) ;
       Mb(i) = -EI2*(q*z2^3/(6*EI2*b)+C(5)*z2+C(6)) ;
       FQ(i) = -EI2*(q*z2^2/(2*EI2*b)+C(5)) ;
   end
end
   
subplot (3,1,1) ; plot (z , v)  , grid on , title ('Biegelinie') , axis ij
subplot (3,1,2) ; plot (z , Mb) , grid on , title ('Biegemoment')
subplot (3,1,3) ; plot (z , FQ) , grid on , title ('Querkraft')

iFeder     = round(n*a/(a+b)+1) ;
vFeder     = v(iFeder)
MbLinks    = Mb(1)
MbFeder    = Mb(iFeder)
Mbmax      = max(abs(Mb))
FQLinks    = FQ(1)
Federkraft = c*vFeder