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dpq Dpp];
DD(2*N+1:3*N,2*N+1:3*N)=Dqqa-c_1*eye(N,N);
DD(3*N+1:4*N,3*N+1:4*N)=Dppb-d_1*eye(N,N);
for i=1:N, for j=1:N
Kqq(i,j)=k_y(i,j);
Kpp(i,j)=k_z(i,j);
Kqqa(i,j)=0;
Kqpa(i,j)=0;
Kpqb(i,j)=0;
Kppb(i,j)=0;
for l=1:N, for k=1:N
Kqq(i,j)=Kqq(i,j)+B_y(i,l,k,j)*q(l)*q(k)+H_y(i,l,k,j)*p(l)*p(k);
Kpp(i,j)=Kpp(i,j)+B_z(i,l,k,j)*p(l)*p(k)+H_z(i,l,k,j)*q(l)*q(k);
Kqqa(i,j)=Kqqa(i,j)+chi4*S_y(i,j,k,l)*q(k)*q(l);
Kqpa(i,j)=Kqpa(i,j)-chi5*S_y(i,j,k,l)*q(k)*dp(l);
Kpqb(i,j)=Kpqb(i,j)+chi4*S_z(i,j,k,l)*p(k)*p(l);
Kppb(i,j)=Kppb(i,j)+chi5*S_z(i,j,k,l)*p(k)*dp(l);
end, end, end, end
KK=eye(4*N,4*N);
KK(1:N,1:N)=Kqq;
KK(N+1:2*N,N+1:2*N)=Kpp;
KK(1:2*N,2*N+1:4*N)=-[Kqqa Kqpa;Kpqb Kppb];
KK(2*N+1:3*N,2*N+1:3*N)=c_2*eye(N,N);
KK(3*N+1:4*N,3*N+1:4*N)=d_2*eye(N,N);
f1=zeros(N,1);
for i=1:N
f1(i)=chi3*c_simp*(abs(V-dy).*f_y(:,i).*V);
end
●for
for i=1:N, for j=1:N
m_y(i,j)=c_simp*(f_y(:,i).*f_y(:,j))+G_m*f_y(n_d+1,i)*df_y(n_d+1,j);
end, end
m_z=m_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
E_y(i,j,k,l)=c_simp*(f_y(:,i).*df_y(:,j).*(simp_u*(df_y(:,k).*df_y(:,l))))…
+G_m*f_y(n_d+1,i)*df_y(n_d+1,j)*c_simp*(df_y(:,k).*df_y(:,l))…
-c_simp*(f_y(:,i).*ddf_y(:,j).*(simp_b*(simp_u*(df_y(:,k).*df_y(:,l)))))…
-G_m*c_simp*(f_y(:,i).*ddf_y(:,j).*(simp_u*(df_y(:,k).*df_y(:,l))));
end, end, end, end
E_z=E_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
F_y(i,j,k,l)=E_y(i,j,k,l);
end, end, end, end
F_z=F_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
M_y(i,j,k,l)=c_simp*(f_y(:,i).*df_y(:,j).*(simp_u*(df_z(:,k).*df_z(:,l))))…
+G_m*f_y(n_d+1,i)*df_y(n_d+1,j)*c_simp*(df_z(:,k).*df_z(:,l))…
-c_simp*(f_y(:,i).*ddf_y(:,j).*(simp_b*(simp_u*(df_z(:,k).*df_z(:,l)))))…
-G_m*c_simp*(f_y(:,i).*ddf_y(:,j).*(simp_u*(df_z(:,k).*df_z(:,l))));
end, end, end, end
M_z=M_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
N_y(i,j,k,l)=c_simp*(f_y(:,i).*df_y(:,j).*(simp_u*(df_z(:,k).*df_z(:,l))))…
+G_m*f_y(n_d+1,i)*df_y(n_d+1,j)*c_simp*(df_z(:,k).*df_z(:,l))…
-c_simp*(f_y(:,i).*ddf_y(:,j).*(simp_b*(simp_u*(df_z(:,k).*df_z(:,l)))))…
-G_m*c_simp*(f_y(:,i).*ddf_y(:,j).*(simp_u*(df_z(:,k).*df_z(:,l))))…
+c_simp*(f_y(:,i).*ddf_y(:,j).*ddf_z(:,k).*ddf_z(:,l)…
+f_y(:,i).*ddf_y(:,j).*df_z(:,k).*dddf_z(:,l)…
+3*f_y(:,i).*df_y(:,j) .*ddf_z(:,k).*dddf_z(:,l)…
+f_y(:,i).*df_y(:,j) .*df_y(:,k).*ddddf_y(:,l));
end, end, end, end
N_z=N_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
S_y(i,j,k,l)=c_simp*(f_y(:,i).*f_y(:,j).*f_y(:,k).*f_y(:,l));
end, end, end, end
S_z=S_y;
for i=1:N, for j=1:N
c_y(i,j)=2*sqrt(beta)*c_simp*(U.*f_y(:,i).*df_y(:,j));
end, end
c_z=c_y;
for i=1:N, for j=1:N
k_y_0(i,j)=c_simp*(gamma*f_y(:,i).*df_y(:,j))+gamma*G_p*f_y(n_d+1,i).*df_y(n_d+1,j)…
-c_simp*(gamma*(1-xi+G_p))+c_simp*(f_y(:,i).*ddddf_y(:,j));
end, end
for i=1:N, for j=1:N
k_y(i,j)= k_y_0(i,j)+sqrt(beta)*c_simp*(dU.*(1-xi).*f_y(:,i).*ddf_y(:,j))…
+c_simp*(U.^2.*f_y(:,i).*ddf_y(:,j));
end, end
k_z=k_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
B_y_0(i,j,k,l)=1/2*gamma*c_simp*(f_y(:,i).*df_y(:,j).*df_y(:,k).*df_y(:,l))…
+1/2*gamma*G_p*f_y(n_d+1,i).*df_y(n_d+1,j).*df_y(n_d+1,k).*df_y(n_d+1,l)…
-3/2*c_simp*(gamma*(1-xi+G_p))…
+c_simp*(f_y(:,i).*ddf_y(:,j).*ddf_y(:,k).*ddf_y(:,l)…
+4*f_y(:,i).*df_y(:,j) .*ddf_y(:,k).*dddf_y(:,l)…
+f_y(:,i).*ddf_y(:,j).*ddf_y(:,k).*ddddf_y(:,l));
end, end, end, end
for i=1:N, for j=1:N, for k=1:N, for l=1:N
B_y(i,j,k,l)= B_y_0(i,j,k,l)…
+3/2*sqrt(beta)*c_simp*(dU.*(1-xi).*f_y(:,i).*ddf_y(:,j).*df_y(:,k).*df_y(:,l))…
+sqrt(beta)*c_simp*(dU.*f_y(:,i).*ddf_y(:,j).*(simp_b*(df_y(:,k).*df_y(:,l))))…
+c_simp*(U.^2.*(f_y(:,i).*df_y(:,j).*df_y(:,k).*ddf_y(:,l)…
-f_y(:,i).*ddf_y(:,j).*(simp_b*(df_y(:,k).*ddf_y(:,l)))));
end, end, end, end
B_z=B_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
H_y_0(i,j,k,l)=1/2*gamma*c_simp*(f_y(:,i).*df_y(:,j).*df_y(:,k).*df_y(:,l))…
+1/2*gamma*G_p*f_y(n_d+1,i).*df_y(n_d+1,j).*df_y(n_d+1,k).*df_y(n_d+1,l)…
-1/2*c_simp*(gamma*(1-xi+G_p).*f_y(:,i).*ddf_y(:,j).*df_y(:,k).*df_y(:,l))…
-c_simp*(gamma*(1-xi+G_p).*f_y(:,i).*df_y(:,j).*df_z(:,k).*ddf_z(:,l));
end, end, end, end
for i=1:N, for j=1:N, for k=1:N, for l=1:N
H_y(i,j,k,l)= H_y_0(i,j,k,l)…
+1/2*sqrt(beta)*c_simp*(dU.*(1-xi).*f_y(:,i).*ddf_y(:,j).*df_y(:,k).*df_y(:,l)…
+sqrt(beta)*(1-xi).*f_y(:,i).*df_y(:,j).*df_z(:,k).*ddf_z(:,l)…
+sqrt(beta)*f_y(:,i).*ddf_y(:,j).*(simp_b*(df_z(:,k).*df_z(:,l))))…
+c_simp*(U.^2.*(f_y(:,i).*df_y(:,j).*df_z(:,k).*ddf_z(:,l)…
-f_y(:,i).*ddf_y(:,j).*(simp_b*(df_y(:,k).*ddf_y(:,l)))));
end, end, end, end
H_z=H_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
D_y(i,j,k,l)=2*sqrt(beta)*c_simp*(U.*(f_y(:,i).*df_y(:,j).*df_y(:,k).*df_y(:,l)…
-f_y(:,i).*ddf_y(:,j).*(simp_b*(df_y(:,k).*df_y(:,l)))));
end, end, end, end
D_z=D_y;
for i=1:N, for j=1:N, for k=1:N, for l=1:N
L_y(i,j,k,l)=2*sqrt(beta)*c_simp*(U.*(f_y(:,i).*df_y(:,j).*df_z(:,k).*df_z(:,l)…
-f_y(:,i).*ddf_y(:,j).*(simp_b*(df_z(:,k).*df_z(:,l)))));
end, end, end, end
L_z=L_y;