gistlib
main.m% Constants beta = 100; Vt = 26e-3; % Thermal voltage % Input current Ib = linspace(0, 1e-3, 100); % Varying input current from 0 to 1 mA % Output characteristics Vce = 0:0.1:5; % Varying Vce from 0 to 5 V Ic = zeros(length(Ib), length(Vce)); % Calculate output current Ic for each Ib and Vce for i = 1:length(Ib) for j = 1:length(Vce) Ic(i, j) = beta * Ib(i) * (exp(Vce(j)/Vt) - 1); end end % Plot the curves figure; hold on; for i = 1:length(Ib) plot(Vce, Ic(i, :), 'DisplayName', ['Ib = ' num2str(Ib(i)*1e3) ' mA']); end hold off; xlabel('V_{CE} (V)'); ylabel('I_{C} (A)'); title('BJT Output Characteristics'); legend('Location', 'northwest'); grid on; 681 chars32 lines
% Constants beta = 100; Vt = 26e-3; % Thermal voltage % Input current Ib = linspace(0, 1e-3, 100); % Varying input current from 0 to 1 mA % Output characteristics Vce = 0:0.1:5; % Varying Vce from 0 to 5 V Ic = zeros(length(Ib), length(Vce)); % Calculate output current Ic for each Ib and Vce for i = 1:length(Ib) for j = 1:length(Vce) Ic(i, j) = beta * Ib(i) * (exp(Vce(j)/Vt) - 1); end end % Plot the curves figure; hold on; for i = 1:length(Ib) plot(Vce, Ic(i, :), 'DisplayName', ['Ib = ' num2str(Ib(i)*1e3) ' mA']); end hold off; xlabel('V_{CE} (V)'); ylabel('I_{C} (A)'); title('BJT Output Characteristics'); legend('Location', 'northwest'); grid on;
gistlibby LogSnag