format shortEng
% CONSTANTS
VT = 26e-3

% VOLTAGE
vcc = 12

% FROM DATASHEET
% Find them in your datasheet and change 
beta = 100
hfe = 110
hre = 1.8e-4
hoe = 15.6

% DESIGN PARAMETERS
RB = 220e3
RE = 2.2e3

%

alpha = beta/(beta+1)
IB = (vcc - 0.7)/(RB + (beta+1)*RE)
IC = (beta+1)*IB
gm = IC/VT
re = alpha/gm
rpi = beta/gm

rmu = rpi/hre
% ro = (hoe - hfe/rmu)^-1 
% It should be like that but it seems our datasheet is misleading.
% Therefore, we will discard that formula and cheat from LTSPICE indeed.
% You may uncommnet that formula and remove the below line if your datasheet is correct.
% Or if yours is wrong too, cheat from LTSPICE and edit the below line

ro = 3.9e4 %% from LTSPICE OP log

Rout = parallels([RE, ro, re])
Rin = parallels([RB, (beta+1)*(re + parallels([RE, ro]))])
absGain = parallels([RE, ro])/(re + parallels([RE, ro]))

%

function res = parallel(R1, R2)
    res = (R1^-1 + R2^-1)^-1;
end

function res = parallels(arr)
    res = (sum(arr.^-1))^-1;
end