I have attached the code but i don't know how to initialize

1 Ansicht (letzte 30 Tage)
mohd ayaz
mohd ayaz am 21 Apr. 2022
Beantwortet: BhaTTa am 18 Mär. 2025
phit1=0.026;
Nd1=1e19;
phim1=5.2
ni=1.5e10;
chi=4.1;
Eg=1.1
Vfb1=phim1-(chi+(Eg/2)-phit1*(log(Nd1/ni)))
ni=1.5e10;
q=1.6e-19;
eox=3.9*8.8*1e-14
tf1=6*10^-7
tox=0.7*10^-7
Cox=eox/tox
esi=8.8*11.7*1e-14
Qss1=3*10^-6
Qc1=2*10^-5
Ec1=1.4*10^6;
Tsc1=1*10^-6;
p1=q*Nd1*Tsc1
alpha_1=-((3*sqrt(3))/4)*(Ec1/Qss1)
beeta_1=((3*sqrt(3))/8)*(Ec1/(Qss1^3))
damma_1=0
alpha1=2*tf1*alpha_1
beeta1=4*tf1*beeta_1
damma1=6*tf1*damma_1
Vgd1=1;
N=30;
Vds=linspace(0,1,N);
Qd1=zeros(1,N);
for i=1:N
syms x
assume(x,'real')
eqnLeft = (Vgd1-Vfb1-Vds(i)+((Tsc1/(8*esi))*(x+p1)))-0.026*(log(2*sqrt(((x+p1)*Tsc1)/(8*3.14*0.026*esi))*(1-((x+p1)/(p1)))));
eqnRight =((alpha1+(1/Cox))*((x+p1)/2))+(beeta1*(((x+p1)/2).^3))+(damma1*(((x+p1)/2).^5));
Qd1(1,i)=vpasolve(eqnLeft == eqnRight,x);
end
%Qd1(1,i)=vpasolve(eqnLeft == eqnRight,x,"What should be here?");

Antworten (1)

BhaTTa
BhaTTa am 18 Mär. 2025
Hey @mohd ayaz, i can see that you have initilized all the variable correctly, Here's a refined version of your code with comments to help you understand each step, please refer to it which is intended to solve a set of equations for a range of values of Vds and store the results in Qd1:
% Constants and Parameters
phit1 = 0.026;
Nd1 = 1e19;
phim1 = 5.2;
ni = 1.5e10;
chi = 4.1;
Eg = 1.1;
Vfb1 = phim1 - (chi + (Eg / 2) - phit1 * (log(Nd1 / ni)));
q = 1.6e-19;
eox = 3.9 * 8.8 * 1e-14;
tf1 = 6 * 10^-7;
tox = 0.7 * 10^-7;
Cox = eox / tox;
esi = 8.8 * 11.7 * 1e-14;
Qss1 = 3 * 10^-6;
Qc1 = 2 * 10^-5;
Ec1 = 1.4 * 10^6;
Tsc1 = 1 * 10^-6;
p1 = q * Nd1 * Tsc1;
alpha_1 = -((3 * sqrt(3)) / 4) * (Ec1 / Qss1);
beeta_1 = ((3 * sqrt(3)) / 8) * (Ec1 / (Qss1^3));
damma_1 = 0;
alpha1 = 2 * tf1 * alpha_1;
beeta1 = 4 * tf1 * beeta_1;
damma1 = 6 * tf1 * damma_1;
Vgd1 = 1;
N = 30;
Vds = linspace(0, 1, N);
Qd1 = zeros(1, N);
% Loop to solve the equation for each value of Vds
for i = 1:N
syms x
assume(x, 'real')
% Define the left and right sides of the equation
eqnLeft = (Vgd1 - Vfb1 - Vds(i) + ((Tsc1 / (8 * esi)) * (x + p1))) - ...
0.026 * (log(2 * sqrt(((x + p1) * Tsc1) / (8 * pi * 0.026 * esi)) * ...
(1 - ((x + p1) / p1))));
eqnRight = ((alpha1 + (1 / Cox)) * ((x + p1) / 2)) + ...
(beeta1 * (((x + p1) / 2).^3)) + ...
(damma1 * (((x + p1) / 2).^5));
% Solve the equation
sol = vpasolve(eqnLeft == eqnRight, x);
% Select the first solution (or handle as needed)
if ~isempty(sol)
Qd1(i) = sol(1); % Assuming you want the first solution
else
Qd1(i) = NaN; % Assign NaN if no solution is found
end
end
% Plotting the results
figure;
plot(Vds, Qd1, 'b-o');
xlabel('Vds (V)');
ylabel('Qd1');
title('Charge Density vs. Vds');
grid on;

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by