gistlib
main.m% Constants VT = 26e-3; IS = 1e-16; BF = 100; BR = 1; % Input Voltage Vi = 0:0.01:1; % Output Voltage Vo = [2, 4, 6, 8, 10, 12]; % Calculation IC = zeros(length(Vo), length(Vi)); for i = 1:length(Vo) for j = 1:length(Vi) VBE = VT*log(IC(i, j)/IS + 1); VCE = Vo(i) - IC(i, j)*BR; IC(i, j) = IS*(exp(VBE/VT) - 1); end end % Plot figure; hold on; colors = ['b', 'r', 'g', 'c', 'm', 'y']; for i = 1:length(Vo) plot(Vi, IC(i, :), colors(i)); end xlabel('Input Voltage (V)'); ylabel('Input Current (A)'); legend('Vo = 2V', 'Vo = 4V', 'Vo = 6V', 'Vo = 8V', 'Vo = 10V', 'Vo = 12V'); title('Input Current vs Input Voltage for Different Output Voltages'); hold off; 696 chars35 lines
% Constants VT = 26e-3; IS = 1e-16; BF = 100; BR = 1; % Input Voltage Vi = 0:0.01:1; % Output Voltage Vo = [2, 4, 6, 8, 10, 12]; % Calculation IC = zeros(length(Vo), length(Vi)); for i = 1:length(Vo) for j = 1:length(Vi) VBE = VT*log(IC(i, j)/IS + 1); VCE = Vo(i) - IC(i, j)*BR; IC(i, j) = IS*(exp(VBE/VT) - 1); end end % Plot figure; hold on; colors = ['b', 'r', 'g', 'c', 'm', 'y']; for i = 1:length(Vo) plot(Vi, IC(i, :), colors(i)); end xlabel('Input Voltage (V)'); ylabel('Input Current (A)'); legend('Vo = 2V', 'Vo = 4V', 'Vo = 6V', 'Vo = 8V', 'Vo = 10V', 'Vo = 12V'); title('Input Current vs Input Voltage for Different Output Voltages'); hold off;
gistlibby LogSnag