double summation in matlab
显示 更早的评论

Plotting j_z/j_o against beta_1 = {0,...,10}; and beta_2 = 1, This is what I have done (check the code below) using symsum but for days now it is still running and want to find out whether there are different methods to that. Thanks in advance ;
clc;
b = 0.142e-9; gammao = 3.0; m = 101;
hbar = 1; e = -1;
K = 8.617e-16; T = 287.5;
a = ((3*b)/(2*hbar)); Pz = ((2*pi*hbar)/(3*b));
beta2 = 1; beta1 = linspace(0,10, 30); % However many you want.
Wcnzz = sqrt(3);
jo = ((8*e*Wcnzz*gammao)/(3*hbar*m*b));
%%
syms q s
B1 = q.*beta1; B2 = q.*beta2; v = ((pi.*s)./m); h = (a.*Pz);
z = (2.*(pi.^2).*s.*sqrt(3).*(a./(2*pi)));
Eqszz = (a./(2*pi)).*((1+(4.*cos(h).*cos(v))+(4.*((cos(v)).^2))).^0.5);
Fqszz = ((a.^2).*m)./((z.*((1+(4.*cos(h).*cos(v))+(4.*((cos(v)).^2))).^0.5))./(K.*T));
J1 = besselj(0,B1); J2 = besselj(0,B2);
J = q.*Fqszz.*Eqszz.*J1.*J2;
X = symsum(J,s,1,m);
jz = symsum(X,q,1,inf);
j = jz./jo;
fplot(beta1, j, 'r-', 'LineWidth', 2 );
drawnow;
grid on;
fontSize = 20;
xlabel('\beta_1', 'FontSize', fontSize)
ylabel('j_z/j_o', 'FontSize', fontSize)
hold on
%%
b = 0.142e-9; gammao = 3.0; m = 101;
hbar = 1; e = -1;
K = 8.617e-16; T = 287.5;
a = ((3*b)/(2*hbar)); Pz = ((2*pi*hbar)/(3*b));
beta2 = 1; beta1 = linspace(0,10, 30); % However many you want.
Wcnac = 1; t = sqrt(3); n = 1e-9;
jo = ((8*e*Wcnac*gammao)/(3*hbar*m*b));
%%
syms q s
B1 = q.*beta1; B2 = q.*beta2; u = ((a.*Pz)./t); g = ((pi.*s.*t)./n);
y = (2.*(pi.^2).*s.*t);
Eqsac = ((1+(4.*cos(g).*cos(u))+(4.*((cos(u)).^2))).^0.5);
Fqsac = ((a.^2).*n)./((y.*((1+(4.*cos(g).*cos(u))+(4.*((cos(u)).^2))).^0.5))./(K.*T));
J1 = besselj(0,B1); J2 = besselj(0,B2);
J = q.*Fqsac.*Eqsac.*J1.*J2;
X1 = symsum(J,s,1,m);
jz = symsum(X1,q,1,inf);
j = jz./jo;
fplot(beta1, j, 'b-', 'LineWidth', 2);
drawnow;
grid on;
fontSize = 20;
xlabel('\beta_1', 'FontSize', fontSize)
ylabel('j_z/j_o', 'FontSize', fontSize)
title('j_x/j_o vs. \beta_1', 'FontSize', fontSize)
legend('zigzig CNs','armchair CNs','Location','Best');
% Maximize the figure window.
hFig.WindowState = 'maximized';
3 个评论
darova
2020-4-21
Look similar. Mistake?

Samuel Suakye
2020-4-21
编辑:Samuel Suakye
2020-4-21
darova
2020-4-21
It's strangle because it can be simplified
回答(1 个)
darova
2020-4-21
Here is numerical approach
clc,clear
% alignComments
b = 0.142e-9;
gammao = 3.0;
m = 101;
hbar = 1;
e = -1;
K = 8.617e-16;
T = 287.5;
a = 3*b/(2*hbar);
Pz = 2*pi*hbar/(3*b);
beta2 = 1;
beta1 = linspace(0,10, 100); % However many you want.
Wcnzz = sqrt(3);
jo = 8*e*Wcnzz*gammao/(3*hbar*m*b);
[q,s] = meshgrid(1:0.1:3,1:m); % 1:0.1:3 span for 'q'
cps = cos(pi.*s./m);
cap = cos(a.*Pz);
Eqszz = a/2/pi*sqrt(1 + 4*cap.*cps + 4*cps.^2);
Fqszz = a^2*m*K*T ./ (2*pi^2*s.*sqrt(3).*Eqszz);
for i = 1:length(beta1)
B1 = q.*beta1(i);
B2 = q.*beta2;
J1 = besselj(0,q.*B1);
J2 = besselj(0,q.*B2);
tmp = q.*Fqszz.*Eqszz.*J1.*J2;
J(i) = sum(tmp(:));
end
plot(beta1,J)
I don't know if q value can be float number but the result looks nices

类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
