Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What's Wrong With My Digital Inverter Circuit Matlab Code?

Status
Not open for further replies.

BatuhantheBatuhan

Newbie level 1
Newbie level 1
Joined
Mar 21, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
9
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

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:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top