[go: up one dir, main page]

0% found this document useful (0 votes)
118 views5 pages

MATLAB Transistor Analysis

The document contains MATLAB code examples for analyzing transistor circuits: 1) A function to calculate transistor parameters for a given circuit. 2) Code to plot the output characteristics by sweeping voltages and calling the function. 3) Code to plot the load line and operating point for a circuit. 4) Code to plot the diode I-V characteristic by sweeping voltage and using the diode equation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views5 pages

MATLAB Transistor Analysis

The document contains MATLAB code examples for analyzing transistor circuits: 1) A function to calculate transistor parameters for a given circuit. 2) Code to plot the output characteristics by sweeping voltages and calling the function. 3) Code to plot the load line and operating point for a circuit. 4) Code to plot the diode I-V characteristic by sweeping voltage and using the diode equation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Communication Dept. MATLAB Lect.

10
_____________________________________________________________________

Applications Examples
Transistor Analysis

1) Write  a  MATLAB  function  M‐file  to  calculate  the  IC,  IB,  IE,  VCE,  and  the
opera on region of the circuit shown in Fig(1):

VCC

RC

RB

VBB

Fig (1) 

Solution: 

0 0 , 0, 0,

, , 1 ,

, , ,

1
Program (trans.m) 
function [IB,IC,IE,VCE]=trans(Vcc,VBB,RC,RB,VBE,B,VCEsat)
IB=(VBB-VBE)/RB;
ICsat=(Vcc-VCEsat)/RC;
if IB <= 0
IB=0
IC=0
IE=0
VCE=Vcc
disp('cut off region')
elseif (B*IB)>= ICsat
IB
IC=ICsat
IE=ICsat
VCE=VCEsat
disp('saturation region')
else
IB
IC=B*IB
IE=(B+1)*IB
VCE=Vcc-(IC*RC)
disp('Active region')
end
Run results 
>> trans(20,5,1e3,10e3,0.7,100,0)
IB =
4.3000e-004
IC =
0.0200
IE =
0.0200
VCE =
0
saturation region
>> trans(20,2,1e3,10e3,0.7,100,0)
IB =
1.3000e-004
IC =
0.0130
IE =
0.0131
VCE =
7.0000
Active region
>> trans(20,0.5,1e3,10e3,0.7,100,0)
IB =
0
IC =
0
IE =
0
VCE =
20
cut off region

2
Output Characteristics

2) Write a MATLAB commands to plot the Output Characteristics of the circuit
shown in Fig (1).

Solution: 

The  trans.m  function  written  in  previous  example  will  be  implemented  in  this 
program to plot the Output Characteristics when 

0.7 , 1 Ω , 500 Ω , 0.2 , 100

1 5 1  

0 1.9 0.1

Program  
clc
clear
RB=500e3;VCEsat=0.2;B=100;VBE=0.7;RC=1e3;
for VBB=1:5
Vcc=0;
for i=1:20
[IB,IC(i),IE,VCE(i)]=trans(Vcc,VBB,RC,RB,VBE,B,VCEsat);
Vcc=Vcc+0.1
end
plot(VCE,IC)
hold on
xlabel('VCE (V)')
ylabel('IC (A)')
title('Output Characteristics','FontSize',12)
axis([0 2 0 10e-4])
end
Run results 
-3
x 10 Output Characteristics
1

0.9

0.8

0.7

0.6
IC (A)

0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
VCE (V)

3
Load line and Q-point

3) Write a MATLAB commands to plot the Load line and Q-point of the circuit shown in
Fig  (1)  when 20 , 1.7 , 0.7 , 0 ,
10 Ω, C 1 Ω, 100 .

Solution: 

The  trans.m  function  written  in  previous  example  will  be  implemented  in  this 
program to plot the load line. 

Program  
clc
clear
Vcc=20;VBB=1.7;RB=10e3;B=100;RC=1e3,VCEsat=0;VBE=0.7;
VCE(1)=0;
IC(1)=(Vcc-VCEsat)/RC;
[IB,IC(2),IE,VCE(2)]=trans(Vcc,VBB,RC,RB,VBE,B,VCEsat);
IC(3)=0;
VCE(3)=Vcc;
plot(VCE,IC,'*-')
xlabel('VCE (V)')
ylabel('IC (A)')
title('Load Line','FontSize',12)
text(VCE(2),IC(2),'{\it Q-point}')
Run results 
Load Line
0.02

0.018

0.016

0.014

0.012
IC (A)

0.01 Q-point

0.008

0.006

0.004

0.002

0
0 2 4 6 8 10 12 14 16 18 20
VCE (V)

4
Diode analysis

4) Write a MATLAB commands to plot the Diode Characteristics .

Solution: 

11600
1 , 300, 10  
2

0.5 0.75 

Program  
clc
clear
Is=10e-6;K=11600/2;T=300;V=-0.5;
for i=1:120
Vd(i)=V;
Id(i)=Is*(exp(K*Vd(i)/T)-1);
V=V+0.01;
end
plot(Vd,Id)
xlabel('Vd (V)')
ylabel('Id (A)')
title('Diode Characteristics','FontSize',12)
Run results 
Diode Characteristics
7

4
Id (A)

-1
-0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8
Vd (V)

You might also like