Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
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 comentario
raviraja
raviraja el 30 de Oct. de 2014
Editada: raviraja el 30 de Oct. de 2014
First tell about the program , like.. for which you have written the code
then select proper tags... then someone can be able to help.. :)

Respuestas (2)

Torsten
Torsten el 30 de Oct. de 2014
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 el 30 de Oct. de 2014
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')

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by