Matlab graphs not showing

조회 수: 2 (최근 30일)
Samuel Suakye
Samuel Suakye 2020년 9월 3일
댓글: Samuel Suakye 2020년 9월 3일
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일
Nothing is plotted because Jx is all NaN's, so something is wrong with your calculations.
  댓글 수: 6
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개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by