% /home/dimarzio/Documents/working/12229/ampgain.m
% Thu Sep 14 11:40:17 2017
R1=2500;R2=1000;RL=10.^[0:0.1:5];beta=100;

AV=-beta*R2/R1*RL./(R2+RL);

figure;semilogx(RL,AV);grid on;

AP=AV.^2./RL*R1;

figure;semilogx(RL,AP);grid on;


% With 100-ohm emitter resistor
% Using node analysis
R1=2500;R2=1000;R3=100;beta=100;Vin=1;
VE=Vin/(1/(R1/(beta+1))+1/R3)/(R1/(beta+1))
I1=(Vin-VE)/R1
I3=VE/R3
Vout=-beta*I1/R2
VE=Vin*(1+beta)/R1/((beta+1)/R1+1/R3)
I1=(Vin-VE)/R1
Vout=-beta*I1*R2
VE =
    0.8016
I1 =
   7.9365e-05
I3 =
    0.0080
Vout =
  -7.9365e-06
VE =
    0.8016
I1 =
   7.9365e-05
Vout =
   -7.9365