Vectors must be the same length
Afficher commentaires plus anciens
Ploting this equation numerically

and this is what I've done (below) but it says vector must be the same length. Thank you for your help
v = (0.01*2.0e-12) ;u = 5.0;
K = 8.617e-5;
T = 300; hBar = 1;
no = 10e16; dg = 1;
trig = (sin(4)*cos(4));
t = 2.0e-12; e = -1;
deltag = 0.0156;
n=[0.00 0.036 0.072];
Betag = linspace(0,10, 30); % However many you want.
p = (0.9*pi);
delta1 = deltag./(K.*T);
I0 = besseli(0,delta1); I1= besseli(1, delta1);
I2 = (I0./I1);
jog = ((no*e*deltag*dg)/hBar).*I2;
[mu] = meshgrid(-10000:100:10000);
legendStrings = cell(length(n), 1);
for k1 = 1:length(n)
thisN = n(k1);
for i = 1:length(Betag)
B1 = Betag(i);
J1 = besselj(mu,B1);
J = (J1.^2);
R = (v + (mu.*u));
S = ((v + (mu.*u)).^2);
Z = (1+thisN.*((I2.*exp(1i.*mu.*p))+1)).*trig;
tmp = ((J.*R)./(1+(2.*thisN)+(thisN.^2)+S)).*Z;
J(i) = jog.*sum(tmp(:));
end
legendStrings{k1} = sprintf('n = %.2f', thisN);
plot(Betag, real(J), '.-', 'LineWidth', 2, 'MarkerSize', 15);
hold on;
drawnow;
end
grid on;
fontSize = 20;
xlabel('\beta_\gamma', 'FontSize', fontSize)
ylabel('\it j_\gamma', 'FontSize', fontSize)
title('\it j_\gamma vs. \beta_\gamma', 'FontSize', fontSize)
legend(legendStrings, 'Location', 'best');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
