Below are my codes
n = 5*10e12;
vf = 1.0*10e6;
mo = 9.109*10e-31;
m = 0.44*mo;
tau = 10e-12;
e = 1; %1.6022e-19;
E0 = 10; % Unit in KV/m
s = 3.5*10e3;
hBar = 1; %6.52*10e-16;
Ed = 50;
Eo = 8.85*10-12;
B = [0.1, 0.2, 0.3]; % Unit in Tesla
W = linspace(0,10, 101); % However many you want.
k = W./s;
a0 = (2*pi*(hBar^2)*Eo)/m/e^2;
s0 = ((e^2)*n*tau)/m;
jo = 1./(e*n*vf);
[L] = meshgrid(-10000:200:10000); % 1:0.1:3 span for 'q'
legendStrings = cell(length(B), 1);
for k1 = 1:length(B)
thisN = B(k1);
Wc = ((e.*thisN)./m);
g = 1 + (1i.*Wc.*tau); gstar = 1 - (1i.*Wc.*tau);
BF = repmat(((k.*vf)./Wc),101,1);
for i = 1:length(W)
R = (L.*(besselj(L,BF).^2))./(1-1i.*(W(i)-(L.*Wc)).*tau);
Rx = ((Wc./k).*sum(R(:)));
Sx = ((L.*besselj(L,BF)).^2)./(1-1i.*(W(i)-(L.*Wc)).*tau);
Sxx = ((2*s0)./(BF.^2)).*sum(Sx(:));
gkw = 1+(1i.*(1./(Eo*(Ed+1))).*(Sxx./(s - Rx)));
J = besselj(L,BF)./(1-1i.*(W(i)-(L.*Wc)).*tau).*(L+((k.*a0.*Sxx)./(Wc.*tau)./(Eo.*(s-Rx)))).*((g.*(L+1).*besselj(L+1,BF))+(gstar.*(L-1).*besselj(L-1,BF)));
Jx = jo.*((abs((s0*E0)./gkw)).^2).*(1./(BF.^2)./(1+(Wc.*tau).^2)).*sum(J(:));
end
legendStrings{k1} = sprintf('B = %.3f', thisN);
plot(W, real(Jx), '-', 'LineWidth', 2, 'MarkerSize', 15);
hold on;
drawnow;
end
grid on;
fontSize = 15;
xlabel('\omega (ns^{-1})', 'FontSize', fontSize)
ylabel('\it j_{x} (\mu A/m)', 'FontSize', fontSize)
title('\it j_{x} (\mu A/m) vs. \omega (ns^{-1}) ', 'FontSize', fontSize)
legend(legendStrings, 'Location', 'Best')

 채택된 답변

maiaL
maiaL 2020년 9월 3일

0 개 추천

Nothing is plotted because Jx is all NaN's, so something is wrong with your calculations.

댓글 수: 6

I don't know what this script is about, seems to be something with eletric/electromagnetic fields. But upon a quick inspection, the source of the NaN's is from divisions by zero in line 29:
Sxx = ((2*s0)./(BF.^2)).*sum(Sx(:));
The first column of BF are zeros, so you have some divisions by zero there.
Samuel Suakye
Samuel Suakye 2020년 9월 3일
Plotting this equation numerically so I used meshgrid
maiaL
maiaL 2020년 9월 3일
Can't help you with the math. The plot part of the script looks alright. It's just that what you're trying to plot are NaN's.
Samuel Suakye
Samuel Suakye 2020년 9월 3일
편집: Samuel Suakye 2020년 9월 3일
Is there any way to plot this numerically ... because of the summation?
maiaL
maiaL 2020년 9월 3일
I dont understand what you're asking.
Samuel Suakye
Samuel Suakye 2020년 9월 3일
I used grid to plot those equations numerically. And am asking whether there is another way to plot same equations using vectors numerically

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2020년 9월 3일

댓글:

2020년 9월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by