can you help me please? What's the wronge in my program

1 次查看(过去 30 天)
clc
clear
g=0.001;
KB=8.5e-5;
T=300;
mL=0.1;
mR=0.01;
ro11=0.05;
ro22=0.04;
d11=0.02;
d1=d11/2;
d22=0.1;
d2=d22/2;
t12=0.005;
tso=0.005;
na=21;
ep1=-0.0999;
ep2=0.1;
h=(ep2-ep1)/(na-1);
ep=ep1;
for j=1:na;
syms E A B ro33
A=[-d1-E 0 -t12 tso;0 d1-E -tso -t12;-t12 -tso -d2-ep-E 0;tso -t12 0 d2-ep-E];
B=det(A);
rr=abs(solve(B));
R(j,1:5)=[ep rr(1:4)'];
ep=ep+h;
end
ep=R(1:na,1);
E1=R(1:na,2);
E2=R(1:na,3);
E3=R(1:na,4);
E4=R(1:na,5);
fE1=1./(exp(((E1-E2-mL)./(KB*T)))+1);
fE11=1./(exp(((E2-E1-mL)./(KB*T)))+1);
fE2=1./(exp(((E1-E2-mR)./(KB*T)))+1);
fE22=1./(exp(((E2-E1-mR)./(KB*T)))+1);
fE3=1./(exp(((E2-E3-mL)./(KB*T)))+1);
fE33=1./(exp(((E3-E2-mL)./(KB*T)))+1);
fE4=1./(exp(((E2-E3-mR)./(KB*T)))+1);
fE44=1./(exp(((E3-E2-mR)./(KB*T)))+1);
fE5=1./(exp(((E3-E4-mL)./(KB*T)))+1);
fE55=1./(exp(((E4-E3-mL)./(KB*T)))+1);
fE6=1./(exp(((E3-E4-mR)./(KB*T)))+1);
fE66=1./(exp(((E4-E3-mR)./(KB*T)))+1);
g12=g.*(fE1+(1.-fE11))+g.*(fE2+(1.-fE22));
g21=g.*(fE11+(1.-fE1))+g.*(fE22+(1.-fE2));
g23=g.*(fE3+(1.-fE33))+g.*(fE4+(1.-fE44));
g32=g.*(fE33+(1.-fE3))+g.*(fE44+(1.-fE4));
g34=g.*(fE5+(1.-fE55))+g.*(fE6+(1.-fE66));
g43=g.*(fE55+(1.-fE5))+g.*(fE66+(1.-fE6));
X=g32.*(-i.*d1+g21).*ro11./g12;
Y=i.*(-d2-ep)+g23+g43;
Z=g34.*g43./(i.*(d2-ep)+g34);
D=i.*(d2-ep)+g34;
F=i.*d1+g12+g32;
L=g12.*g21./(-i.*d1+g21);
M=(F-L).*ro22./g23;
ro33=X./(Y-Z);
ro3=abs(ro33);
C1=g.*ro3;
ro44=g43.*M./D;
ro4=abs(ro44);
C2=g.*ro4;
P=(C1-C2)./(C1+C2);
% plot(ep,P)
plot(ep,C1/g,ep,C2/g,'linewidth',1.2)
legend('current')
xlabel('\epsilon','FontSize',18)
ylabel('I/\Gamma','FontSize',18)

采纳的回答

KSSV
KSSV 2018-4-6
Repalce plot with:
% plot(ep,P)
ep = double(ep) ;
C1 = double(C1) ;
C2 = double(C2) ;
plot(ep,C1/g,ep,C2/g,'linewidth',1.2)
legend('current')
xlabel('\epsilon','FontSize',18)
ylabel('I/\Gamma','FontSize',18)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Formatting and Annotation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by