The gain of transistor Q1 was previously calculated in this post
simulate this circuit – Schematic created using CircuitLab
It was found to have a gain of about 2.92. Now I change the parameters as below:
The DC gain of both Q1 and Q2 is roughly 270. When I calculate the gain calculated according to the formula in the above link, I get
$$A_v=\frac{R3||R7+R8||\beta_{Q2}(r_e'+X_c)}{X_c+r_e'}=28.65$$
However, my simulation gave a gain which is about 40.
After that I recalculate again by considering the real part and the imaginary part as below I get:
$$A_v=\frac{R3||R7+R8||\beta_{Q2}(r_e'+\frac{1}{jwC})}{r_e'+\frac{1}{jwC}}=\frac{R3||R7+R8||\beta_{Q2}(22.72-30j)}{22.72-30j}=\frac{1515-181j}{22.72-30j}=40.55$$
That is much closer to the simulation value.
Do we calculate in such a way or it just by sheer luck using the wrong method to get the value which is closer to the simulation value? After all, this is calculating the impedance as view by the AC signal right?
I also calculated the gain for the first diagram by considering the imaginary part and real part. I got the gain as 2.8 which is not far from the gain of 2.9