Example 5 --------- Noise analysis of cascaded resistor V->I and I->V amplifier ``````````````````````````````````````````````````````````` .. image:: viiv.* In this example we are analyzing a balanced resistor V->I converter and a I->V amplifier in cascade. The active element of the I->V amplifier is a noise nullor with imput referred noise sources :math:`v_{n,1}` and :math:`i_{n,1}`. The goal is to use the symbolic 2-port analysis to calculate gain and input referred noise. .. sympy:: from sympy import * import numpy, pylab from pycircuit.circuit import * Ri,Rfb,Sv1,Si1,mu = symbols('R_i R_{fb} S_{v_{1}} S_{i_{1}} mu', real=True, positive=True) ## Create circuit cir = SubCircuit(toolkit=symbolic_poly) cir['Ri1'] = R('vinp', 1, r=Ri, toolkit=symbolic_poly) cir['Ri2'] = R('vinn', 2, r=Ri, toolkit=symbolic_poly) cir['Rfb1'] = R(1, 'voutp', r=Rfb, toolkit=symbolic_poly) cir['Rfb2'] = R(2, 'voutn', r=Rfb, toolkit=symbolic_poly) cir['Vn'] = VS(1, 3, vac=0, noisePSD = Sv1, toolkit=symbolic_poly) cir['In'] = IS(3, 2, iac=0, noisePSD = Si1, toolkit=symbolic_poly) cir['nullor'] = Nullor(3,2,'voutp','voutn', toolkit=symbolic_poly) ## Run symbolic 2-port analysis twoport_ana = TwoPortAnalysis(cir, 'vinp', 'vinn', 'voutp', 'voutn', method='sparam', noise=True) result = twoport_ana.solve(freqs=Symbol('s'), complexfreq=True, refnode=Node('vinn')) ## Print ABCD parameter matrix ABCD = Matrix(result['twoport'].A) ABCD.simplify() ABCD Calculate Voltage gain (mu) .. sympy:: :persistent: mu_calc = 1 / ABCD[0,0] mu_calc Solve for Rfb .. sympy:: :persistent: mu_solve = solve(mu-abs(mu_calc),Rfb) mu_solve[0] Input referred voltage noise power spectral density .. sympy:: :persistent: a = expand(result['Svn']) collect(a,[Sv1,Si1,twoport_ana.par.epar.T*twoport_ana.toolkit.kboltzmann]) Using Rfb = μ * Ri .. sympy:: :persistent: collect(expand(a.subs({Rfb:mu_solve[0]})),[Sv1,Si1,twoport_ana.par.epar.T*twoport_ana.toolkit.kboltzmann]) Input referred current noise power spectral density .. sympy:: :persistent: collect(expand(result['Sin']).subs({Rfb:mu_solve[0]}),[Sv1,Si1,twoport_ana.par.epar.T*twoport_ana.toolkit.kboltzmann])