help need im my code
조회 수: 2 (최근 30일)
이전 댓글 표시
NA= 1*10^18;
ND= 5*10^17;
phi= 0.913;
l=6*10^--9;
w=11*10^-9;
t=1.1*10^-9;
go= 5.7*10^-8;
es= 1.053*10^-12;
q=1.6*10^-19;
for vg= (0 -1 -2 -3 -4 -5 );
vd= (q*Nd*t^2 )./(phi-vg);
Id= Go*(((q*ND*t^2)/6*es)-(phi-vg)*(1-0.667*((2*es*(phi-vg))/(q*ND*t^2))^0.5);
disp(Vd);
disp(ID);
end
Vd=[-0.91 -1.91 -2.91 -3.91 -4.91 -5.91 ];
ID = [1.09*10^5 3.31*10^5 6.22 *10^5 9.67*10^5 1.36 *10*6 1.8*10^6 ];
댓글 수: 0
답변 (3개)
Guillaume
2016년 11월 8일
Of course it's not running
vg= (0 -1 -2 -3 -4 -5 )
is not valid syntax. Perhaps you meant:
vg = [0 -1 -2 -3 -4 -5]
which could be simply written
vg = 0:-1:-5
Then,
Id= Go*(((q*ND*t^2)/6*es)-(phi-vg)*(1-0.667*((2*es*(phi-vg))/(q*ND*t^2))^0.5);
is missing a closing parentheses somewhere.
The error messages that matlab is giving you do tell you what is wrong.
댓글 수: 0
KSSV
2016년 11월 8일
clc; clear all ;
NA= 1*10^18;
ND= 5*10^17;
phi= 0.913;
l=6*10^--9;
w=11*10^-9;
t=1.1*10^-9;
go= 5.7*10^-8;
es= 1.053*10^-12;
q=1.6*10^-19;
VG = [0 -1 -2 -3 -4 -5] ;
vd = zeros(size(VG)) ;
Id = zeros(size(VG)) ;
for i = 1:length(VG)
vg = VG(i) ;
vd(i)= (q*ND*t^2 )./(phi-vg);
Id(i)= go*(((q*ND*t^2)/6*es)-(phi-vg)*(1-0.667*((2*es*(phi-vg))/(q*ND*t^2))^0.5));
end
Vd=[-0.91 -1.91 -2.91 -3.91 -4.91 -5.91 ];
ID = [1.09*10^5 3.31*10^5 6.22 *10^5 9.67*10^5 1.36 *10*6 1.8*10^6 ];
댓글 수: 0
Jan
2016년 11월 8일
There is an unintented "-" in:
l=6*10^--9;
It is not an error, but more efficient not to perform the power operation explicitely, because it is very expensive. Much faster:
l = 6e-9;
This is a constant and does not require any processing time during the execution.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!