help need im my code

1 次查看(过去 30 天)
Kidist Getu
Kidist Getu 2016-11-8
回答: Jan 2016-11-8
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 ];

回答(3 个)

Guillaume
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.

KSSV
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 ];

Jan
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.

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by