BatuhantheBatuhan
Newbie level 1
I am really sorry if this is the wrong place to post this question.
I wanted to see the relationship between the Vgs and the Vds in a resistive load inverter and tried to plot it on MATLAB
Here's my code the plot is not correct.
Could anyone have a quick look at it?
That 5 volts in 5 - Kn*Rd.... is VDD
Vdd is 5 volts
I wanted to see the relationship between the Vgs and the Vds in a resistive load inverter and tried to plot it on MATLAB
Here's my code the plot is not correct.
Could anyone have a quick look at it?
That 5 volts in 5 - Kn*Rd.... is VDD
Vdd is 5 volts
Code:
vo = 0:1:50;
vin = 0:1:50;
Kn = 1;
Rd = 5000;
Vtn = 3;
for i=1:51
if [vin(i) < Vtn]
vo(i) = 5;
else
if [ vo(i) >= (vin(i)-Vtn)]
vo(i) = 5 - Kn*Rd*(vin(i)-Vtn)^2;
else
if [vo(i) < (vin(i) - Vtn)]
vo(i) = 5 - Kn*Rd*[2*(vin(i)-Vtn)*vo(i) - vo(i)^2];
end
end
end
i=i+1;
end
figure
plot(vin,vo)
Last edited by a moderator: