plot i-v for a common emitter bjt according to the ebers-moll equations in matlab

main.m
% Constants
q = 1.6e-19; % Charge of an electron in Coulombs
k = 1.38e-23; % Boltzmann constant in J/K
T = 300; % Temperature in Kelvin

% BJT parameters
Is = 1e-14; % Saturation current for the diodes in the BJT
beta = 100; % Common-emitter current gain
Vt = k*T/q; % Thermal voltage

% Voltages
Vcc = 10; % Collector voltage
Rc = 1e3; % Collector resistance
Re = 500; % Emitter resistance

Vb = 0:0.01:1; % Base voltage
Ic = Is*(exp(Vb/Vt) - 1); % Collector current
Ie = Ic; % Emitter current

% Plot
plot(Vb, Ie.*Re, 'b', Vb, Vcc/Rc - Ic*Rc, 'r'); % Blue line is the base current, red line is the collector current
xlabel('Base Voltage (V)');
ylabel('Current (A)');
legend('Base Current', 'Collector Current');
714 chars
25 lines

related categories

gistlibby LogSnag