clear
format long
global XXX
XXX=0;
syms E u a z E1 E2 E3 E4 u1 u2 u3 u4 h1 h2 h3 z1 z2 z3 z4 s b l zz r1 r2 r3 r4 p0
t11=cosh(a.*z)+1/2./(1-u).*a.*z.*sinh(a.*z);
t12=1./2./(1-u).*((1-2*u).*sinh(a.*z)+a.*z.*cosh(a.*z));
t13=(1+u)./2./(1-u)./E.*z.*sinh(a.*z);
t14=(1+u)./2./(1-u)./E./a.*((3-4*u).*sinh(a.*z)+a.*z.*cosh(a.*z));
t21=1./2./(1-u).*((1-2*u).*sinh(a.*z)-a.*z.*cosh(a.*z));
t22=cosh(a.*z)-1./2./(1-u).*a.*z.*sinh(a.*z);
t23=(1+u)./2./(1-u)./E./a.*((3-4*u).*sinh(a.*z)-a.*z.*cosh(a.*z));
t24=-t13;
t31=-E./2./(1-u.^2).*a.^2.*z.*sinh(a.*z);
t32=E./2./(1-u.^2).*a.*(sinh(a.*z)-a.*z.*cosh(a.*z));
t33=t22;
t34=-t12;
t41=E./2./(1-u.^2).*a.*(sinh(a.*z)+a.*z.*cosh(a.*z));
t42=-t31;
t43=-t21;
t44=t11;
T=[t11 t12 t13 t14; t21 t22 t23 t24; t31 t32 t33 t34; t41 t42 t43 t44];
y1=subs(T,E,E4);y2=subs(y1,u,u4);T4=subs(y2,z,z4-z3);t4=subs(y2,z,zz-z3);
yy1=subs(T,E,E3);yy2=subs(yy1,u,u3);T3=subs(yy2,z,h3);t3=subs(yy2,z,zz-z2);
yyy1=subs(T,E,E2);yyy2=subs(yyy1,u,u2);T2=subs(yyy2,z,h2);t2=subs(yyy2,z,zz-z1);
yyyy1=subs(T,E,E1);yyyy2=subs(yyyy1,u,u1);T1=subs(yyyy2,z,h1);t1=subs(yyyy2,z,zz);
g4=t4*T3*T2*T1;
g3=t3*T2*T1;
g2=t2*T1;
g1=t1;
H=T3*T2*T1