Info

此问题已关闭。 请重新打开它进行编辑或回答。

Please help with following code i am new with matlab and don't understand the error

1 次查看(过去 30 天)
clear
Eg = input('Enter your value for Eg(T) = ');
x = input('Enter your lower range for T = ');
y = input('Enter your higher range for T = ');
kb = 1.38*10^-23;
h = 6.63*10^-34;
T = x:10:y;
me = 6.19*10^-32;
mh = 5.10*10^-31;
k = (2*(((2*pi*kb*T)/(h^2))^1.5)*((me*mh)^3/4))
ni = k*exp((-Eg/2*kb*T))
plot(ni,T);
xlabel('Ni');
ylabel('Temperature');
display(ni);
  1 个评论
raviraja
raviraja 2014-10-30
编辑:raviraja 2014-10-30
First tell about the program , like.. for which you have written the code
then select proper tags... then someone can be able to help.. :)

回答(2 个)

Torsten
Torsten 2014-10-30
Try
k = 2*(2*pi*kb*T/h^2).^1.5*(me*mh)^3/4
instead of
k = (2*(((2*pi*kb*T)/(h^2))^1.5)*((me*mh)^3/4))
Best wishes
Torsten.

MA
MA 2014-10-30
clear all
clc;
Eg = input('Enter your value for Eg(T) = ');
x = input('Enter your lower range for T = ');
y = input('Enter your higher range for T = ');
kb = 1.38*10^-23;
h = 6.63*10^-34;
T = x:10:y;
me = 6.19*10^-32;
mh = 5.10*10^-31;
k=zeros(1,length(T));
ni=zeros(1,length(T));
for i=1:length(T)
k(i)=2*(((2*pi*kb*T(i))/(h^2))^1.5)*(((me*mh)^3)/4);
ni(i)=k(i)*exp(-Eg/(2*kb*T(i)));
end
plot(ni,T)
xlabel('Ni')
ylabel('Temperature')

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by