Series summation and double summation

1 回表示 (過去 30 日間)
Allan Wai
Allan Wai 2019 年 6 月 29 日
編集済み: Allan Wai 2019 年 6 月 29 日
Not homework, comparing results to equation.
I triple checked that my equations are in correct order and just need help with formatting a double summation series problem.
This is just one parameter and have several more. I plan to write a nested for loop to vary different L1 and L.
Is there an easier way of writing this code?
Thank you!
Capture.PNG
L1 =6e-3;
L =40e-3 ;
W1 = L1;
W = L;
t =.0005/2;
kz = 15;
kxy = 800;
keff = sqrt(kz*kxy);
gamma = sqrt(kz/kxy);
teff = t/gamma;
h = 50;
%
w = 1000;
series1 = 0;
series2= 0;
series3 =0;
S= [];
%
for m = 1:w
del_m = (m.*pi/L);
A = 2*L1^2*L*W*keff;
A_1= 2*del_m*teff;
A1 = ((exp(A_1)+1).*del_m*teff-(1-exp(A_1)).*h*teff/keff)./((exp(A_1)-1).*del_m*teff+(1+exp(A_1)).*h*teff/keff);
A2 = 1/A* sin(L1.*del_m).^2./(del_m.^3).*A1;
series1=series1+A2;
end
%
for n = 1:w
lad_n = (n.*pi/W);
B = 2*W1^2*L*W*keff;
B_1= 2.*lad_n*teff;
B1 = ((exp(B_1)+1).*lad_n*teff-(1-exp(B_1)).*h*teff/keff)./((exp(B_1)-1).*lad_n*teff+(1+exp(B_1)).*h*teff/keff);
B2 = 1/B*(sin(W1.*lad_n).^2./(lad_n.^3)).*B1;
series2 = series2+B2;
end
%
for m = 1:w
for n = 1:w
del_m = (m.*pi/L);
lad_n = (n.*pi/W);
B_mn = sqrt(del_m.^2+ lad_n.^2);
C = L1^2*W1^2*L*W*keff;
C_1= 2.*B_mn*teff;
C1 = ((exp(C_1)+1).*B_mn*teff-(1-exp(C_1)).*h*teff/keff)./((exp(C_1)-1).*B_mn*teff+(1+exp(C_1)).*h*teff/keff);
C2 = 1/C*(sin(L1.*del_m).^2.*sin(W1.*lad_n).^2)./(del_m.^2.*lad_n.^2.*B_mn).*C1;
series3=series3+C2;
end
end
S = series1 +series2 +series3;

回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by