Plotting the different solution via fzero solver against a range of one of the variable
1 view (last 30 days)
Show older comments
I am bit new to the matlab; I am having trouble with this, I got different values of phi0 at different Nt using fzero solver; called phi0value. I want to plot Nt v/s phi0value? I used plot (Nt, phi0) for this, it is not working. I dont know how to plot a range of output against a range of variable? Please guide me through this.This will be a great help!! Thank You.
N = 100;
% define the parameters
Nd = 1e23;
e = 12*1e-12;
%r = 0
R = 20*1e-9;
Et_Ef = -0.21*1.6*1e-19;
K = 1.3807e-23;
T = 600;
Nt = linspace(1e15,1e17,N);
q = 1.6e-19;
for i = 1:N
Ld = sqrt(e*K*T/(q^2*Nd))
funct= @(R,phi0) (4.*pi.*(Nd-Nd.*exp(-phi0)).*R.^2)
equation = @(phi0)integral(@(R)funct(R,phi0),0,R,'ArrayValued',true)-(4*pi.*R.^2.*Nt(i)./(1+2*exp((Et_Ef + K*T .*(phi0 + (1/6).*(R/Ld).^2))/(K.*T))));
%X= [0 10];
phi0value = fzero(equation,10)
end
plot (Nt,phi0val)
0 Comments
Accepted Answer
Stephan
on 7 Jun 2019
N = 100;
% define the parameters
Nd = 1e23;
e = 12*1e-12;
%r = 0
R = 20*1e-9;
Et_Ef = -0.21*1.6*1e-19;
K = 1.3807e-23;
T = 600;
Nt = linspace(1e15,1e17,N);
q = 1.6e-19;
phi0value = zeros(1,N);
for ii = 1:N
Ld = sqrt(e*K*T/(q^2*Nd))
funct= @(R,phi0) (4.*pi.*(Nd-Nd.*exp(-phi0)).*R.^2)
equation = @(phi0)integral(@(R)funct(R,phi0),0,R,'ArrayValued',true)-(4*pi.*R.^2.*Nt(ii)./(1+2*exp((Et_Ef + K*T .*(phi0 + (1/6).*(R/Ld).^2))/(K.*T))));
%X= [0 10];
phi0value(ii) = fzero(equation,10)
end
plot (Nt,phi0value)
More Answers (0)
See Also
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!