ABD_Matrix_2 = -[227136.359975841,69646.0036239179,0,-454272.719951681,-139292.007247836,0;
69646.0036239179,227136.359975841,7.27595761418343e-12,-139292.007247836,-454272.719951681,-1.63709046319127e-11;
0,7.27595761418343e-12,78745.1781759614,-1.81898940354586e-12,-1.45519152283669e-11,-157490.356351923;
-454272.719951681,-139292.007247836,0,1258428.76767918,370536.863822059,-7688.75830481177;
-139292.007247836,-454272.719951681,-1.63709046319127e-11,370543.054681733,1166169.85888112,-7688.75830481172;
-1.81898940354586e-12,-1.45519152283669e-11,-157490.356351923,-7687.72649486611,-7687.72649486608,419068.890196128];
R = 2730;
s = pi/180;
a = (ABD_Matrix_2(1,1)*ABD_Matrix_2(1,5) - ABD_Matrix_2(1,4)*ABD_Matrix_2(1,2));
a2 = (ABD_Matrix_2(1,1)*ABD_Matrix_2(1,5) - ABD_Matrix_2(1,4)*ABD_Matrix_2(1,2));
a4 = (- ABD_Matrix_2(2,1)*ABD_Matrix_2(4,4)*ABD_Matrix_2(1,2)+ ABD_Matrix_2(2,1)* ABD_Matrix_2(1,4)* ABD_Matrix_2(1,5)- ABD_Matrix_2(5,4)* ABD_Matrix_2(1,1)* ABD_Matrix_2(1,5)+ ABD_Matrix_2(2,4)*ABD_Matrix_2(1,4)*ABD_Matrix_2(1,2));
a11 = -ABD_Matrix_2(2,1)*ABD_Matrix_2(4,4) + ABD_Matrix_2(2,4)*ABD_Matrix_2(1,4);
a1 = - ABD_Matrix_2(1,2)*ABD_Matrix_2(4,4) + ABD_Matrix_2(2,4)*ABD_Matrix_2(1,4);
a12 = - ABD_Matrix_2(1,5)*ABD_Matrix_2(4,4) + ABD_Matrix_2(1,4)*ABD_Matrix_2(4,5);
a31 = - ABD_Matrix_2(1,2)* ABD_Matrix_2(1,4) + ABD_Matrix_2(2,4)* ABD_Matrix_2(1,1);
a33 = - ABD_Matrix_2(1,4)* ABD_Matrix_2(1,5) + ABD_Matrix_2(4,5)* ABD_Matrix_2(1,1);
det_dome = - ABD_Matrix_2(1,1)* ABD_Matrix_2(4,4) + ABD_Matrix_2(1,4)^2;
a41 = - ABD_Matrix_2(2,1)*ABD_Matrix_2(4,4)*ABD_Matrix_2(1,2) + ABD_Matrix_2(2,1)*ABD_Matrix_2(1,4)*ABD_Matrix_2(1,5) + ABD_Matrix_2(2,4)*ABD_Matrix_2(1,4)*ABD_Matrix_2(1,2) - ABD_Matrix_2(2,4)*ABD_Matrix_2(1,5)*ABD_Matrix_2(1,1);
a63 = - ABD_Matrix_2(2,4)*ABD_Matrix_2(4,4)*ABD_Matrix_2(1,5) + ABD_Matrix_2(4,5)*ABD_Matrix_2(2,4)*ABD_Matrix_2(1,4) + ABD_Matrix_2(5,4)*ABD_Matrix_2(1,4)*ABD_Matrix_2(1,5) - ABD_Matrix_2(5,4)*ABD_Matrix_2(1,1)*ABD_Matrix_2(4,5);
a46 = - ABD_Matrix_2(2,1)* ABD_Matrix_2(1,4) + ABD_Matrix_2(2,4)* ABD_Matrix_2(1,1);
a66 = - ABD_Matrix_2(2,4)* ABD_Matrix_2(1,4) + ABD_Matrix_2(5,4)* ABD_Matrix_2(1,1);
a64 = - ABD_Matrix_2(2,4)* ABD_Matrix_2(4,4) + ABD_Matrix_2(5,4)* ABD_Matrix_2(1,4);
for alpha = 1:89
phi = alpha*2/10;
phi_rad = phi*pi/180;
r = 2730 * cos(phi_rad);
A_sp{alpha,:} = [(a1 * sin(phi_rad))/(det_dome*r),1/2730 - (a1* cos(phi_rad))/(det_dome*r),(-sin(phi_rad)*a12)/(r*det_dome),-ABD_Matrix_2(4,4)/(det_dome*r),0,-ABD_Matrix_2(1,4)/(det_dome*r),0;
-1/2730,0,1,0,0,0,0;
(sin(phi_rad)*a31)/(r*det_dome),-(cos(phi_rad)*a31)/(r*det_dome),(-sin(phi_rad)*a33)/(r*det_dome),-ABD_Matrix_2(1,4)/(r*det_dome),0,-ABD_Matrix_2(1,1)/(r*det_dome),0;
-sin(phi_rad)*(-ABD_Matrix_2(2,2)*sin(phi_rad)/r + sin(phi_rad)/det_dome*r*(a41)) ,- sin(phi_rad)*(ABD_Matrix_2(2,2)*cos(phi_rad)/r - cos(phi_rad)/det_dome*r*(a41)) , sin(phi_rad)*(ABD_Matrix_2(2,5)*-sin(phi_rad)/r + sin(phi_rad)/det_dome*r*(a41)) , ((-sin(phi_rad)*a11)/(det_dome*r)) , 1/2730 ,((sin(phi_rad)*a46)/(det_dome*r)),0;
cos(phi_rad)*(ABD_Matrix_2(2,2)*-sin(phi_rad)/r + sin(phi_rad)/det_dome*r*(a41)) , cos(phi_rad)*(ABD_Matrix_2(2,2)*cos(phi_rad)/r - cos(phi_rad)/det_dome*r*(a41)), cos(phi_rad)*(ABD_Matrix_2(2,5)*sin(phi_rad)/r - sin(phi_rad)/det_dome*r*(a41)), -1/2730 + (cos(phi_rad) * a11)/(det_dome*r) ,0,-((cos(phi_rad)*a46)/(det_dome*r)),-0.4*(0.5-0.5*0.009);
sin(phi_rad)*(ABD_Matrix_2(2,5)*-sin(phi_rad)/r + sin(phi_rad)/det_dome*r*(a41)) , sin(phi_rad)*(ABD_Matrix_2(2,5)*cos(phi_rad)/r - cos(phi_rad)/det_dome*r*(a41)), sin(phi_rad)*(sin(phi_rad)*(ABD_Matrix_2(5,5)*r)-(sin(phi_rad)/(det_dome*r))*a63) + 546 * r, ((sin(phi_rad)*a64)/(det_dome*r)), -1, ((-sin(phi_rad)*a66)/(det_dome*r)) ,0;
0,0,0,0,0,0,0];
end
Differentialmatrix_Kugel_final = cell2mat(A_sp);
B{1,:} = eye(7,7)
for j= 1:88-1
m_1 = A_sp{j,:}*B_sp{j,:} ;
m_2 = (A_sp{j,:}+A_sp{j+1,:}/2)*(B_sp{j,:}+0.5*0.2*m_1);
m_3 = (A_sp{j,:}+A_sp{j+1,:}/2)*(B_sp{j,:}+0.5*0.2*m_2);
m_4 = (A_sp{j,:})*(B_sp{j,:}+m_3*0.2);
B_sp{j+1,:} = B_sp{j,:} + (0.2/6)*(m_1+2*m_2+2*m_3+m_4);
end