Problem in integration in an array inside integrand
Afficher commentaires plus anciens
I am getting the error named "Attempted to access R(2); index out of bounds because numel(R)=1." in the below code. can anyone help me? below is my code.
Nd = 1e24;
N = 100;
e = 12*1e-12;
% R = [10e-9,20e-9,30e-9,40e-9];
R = [1e-9,2e-9,3e-9,4e-9]
Et_Ef = -1.01*1.6*1e-19;
K = 1.3807e-23;
T = linspace(450,600,N);
Nt = linspace(1e14,1e17,N);
q = 1.6e-19;
Ld = 1.97*10e-9
for j = 1:numel(R)
for i= 1:N
funct = @(R,phi0) (4*pi*(Nd-Nd*exp(-phi0))*R.^2);
equation = @(phi0)integral(@(R)funct(R,phi0),0,R(j))-(4*pi*R(j)^2*Nt(i)/(1+2*exp((Et_Ef + K.*T(i) .*(phi0 + (1/6)*(R(j)/Ld)^2))./(K.*T(i)))));
%equation = @(phi0)integral(@(r)funct(r,phi0),0,R)-(4*pi*R^2*Nt(i)/(1+2*exp((Et_Ef + K*T *(phi0 + (1/6)*(R/Ld)^2))/(K*T))));
phi0val(j,i) = fzero(equation,40);
funneff= @(R)1./(4/3.*pi.*R(j).^3).*(Nd.*exp(-phi0val(j,i))).*R(j).^2
neff(j,i)= (1./(4./3.*pi.*R(j).^3)).*4.*pi.*integral(funneff,0,R(j),'Arrayvalued',true)
end
end
plot(neff(1,:),phi0val(1,:))
plot(neff(2,:),phi0val(2,:))
plot(neff(2,:),phi0val(2,:))
plot(neff(2,:),phi0val(2,:))
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Physics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
