I didn't know how to define my vector

1 view (last 30 days)
MAROUANE ENNAGADI
MAROUANE ENNAGADI on 9 May 2019
Answered: Guillaume on 10 May 2019
Hello,
I have a problem when I define my vector Et, because Et include in my interval E. I know that is not normal, my purpose is to have many values of mobility according to Et.
My program :
% Main Principal :
% Data:
sigma=0.1; % energy scale of the disorder (eV)
e=1.6e-19;
N=10.^26; % the concentration of localized states (m^3)
E_LUMO=0;
K_B=8.625e-5; % Boltzmann constant (eV/K)
T=300; % Témperature Ambiante (K)
Bc=2.735; % average number of sites within the sphere of radius rc around a given site
Alpha=0.215*N.^(-1./3); % the localization length (m)
Ef=E_LUMO-0.5; % Fermi energy (eV)
F_ER=1; % the function FER derived by Roichman and Tessler
Frequence_0=10^12; % frequency (Hz)
E1=-10*sigma; % starting value of integrale (eV)
N_0=1000; % Number of points
Et=0:-0.01:-0.5;
E=linspace(E1,Et,N_0);
for i=1:size(Et)
[Gauss]=densite_Gaussienne(N,sigma,E,E_LUMO);
[S_F_D]=statistque_Fermi_Dirac(E,Ef,K_B,T);
[Multi_G_F_D]=multiplication_G_D(Gauss,S_F_D);
[nt]=concentration_t(E,Multi_G_F_D);
[r_E_t]=radius(Bc,E,Gauss);
[Mobility]=mo_bi_li_ty(Frequence_0,e,K_B,T,Bc,F_ER,r_E_t,nt,Alpha,Et,Ef);
end
I received this problem:
Error using .*
Matrix dimensions must agree.
Error in linspace (line 30)
y = d1 + (0:n1).*(d2 - d1)/n1;
Error in Model_with_Loop_For (line 15)
E=linspace(E1,Et,N_0);
Please, can someone help me.
Best regard;
  4 Comments
Star Strider
Star Strider on 9 May 2019
@Marouane — What are the arguments to linspace? None of them appear to be defined before the linspace call, at least in the code you posted.
MAROUANE ENNAGADI
MAROUANE ENNAGADI on 9 May 2019
E1=-10*sigma; % starting value of integrale (eV)
N_0=1000; % Number of points
Et=0:-0.01:-0.5;
E=linspace(E1,Et,N_0);

Sign in to comment.

Answers (1)

Guillaume
Guillaume on 10 May 2019
In my version of matlab (R2019a), passing a vector to linspace give the following error:
Error using linspace (line 22)
Inputs must be scalars.
which makes more sense than the error you see. In any case, the cause of your error is the same, linspace is not designed to work with vector inputs since its whole purpose is to return a vector of values linearly spaced between two values.
If you tell us what you're hoping to get when one (or more) input is a vector we can tell you how to do it.

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!