plot output curves of bjt based amplifier for common emitter configuration in matlab

main.m
% Define the parameters of the amplifier
Vcc = 12; % Supply voltage in volts
Rc = 2.2e3; % Collector resistor in ohms
Rb = 47e3; % Base resistor in ohms
Re = 1e3; % Emitter resistor in ohms
Vbe = 0.7; % Base-to-emitter voltage in volts
Beta = 100; % Current gain of the transistor

% Define the input voltage range
Vin = linspace(0, 1, 1000); % Input voltage varies from 0 to 1V

% Calculate the output voltage Vo for each input voltage
Vo = zeros(size(Vin));
for i = 1:length(Vin)
    Ib = (Vin(i) - Vbe) / Rb; % Base current
    Ic = Beta * Ib; % Collector current
    Ie = (Beta + 1) * Ib; % Emitter current
    Vce = Vcc - Ic * Rc - Ie * Re; % Output voltage
    Vo(i) = Vce;
end

% Plot the input and output curves
figure;
plot(Vin, Vo);
xlabel('Input Voltage (V)');
ylabel('Output Voltage (V)');
title('BJT Common Emitter Amplifier Output Characteristic');
grid on;
872 chars
29 lines

gistlibby LogSnag