Code covered by the BSD License

# Indirect Feedback Compensation Techniques for Multi-Stage Operational Amplifiers

### Vishal Saxena (view profile)

Matlab simulation files for designing Two and Three-Stage Opamps using Indirect Compensation.

TwoStageIndirectCompensation_SLDP.m
```%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Indirect Feedback Compensation of 2-Stage Opamp
% Split Length Differential Pair (SLDP) Topology (MS Thesis Pg. 42, Fig. 2-28)
% CL=30pF.
% Vishal Saxena
% Boise State University
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all; clc;
%% Define the circuit symbols here
syms s vs v1 vo va s R1 R2 Ra ron gm1 gm2 gmn C1 C2 Ca Cc;
% Nodal Analysis Equations
eq1 = 'gmn*va + va*s*Ca +gmn*(va-vs/2) + (va-v1)/ron + s*Cc*(va-vo)=0'
eq2 = '-gmn*(va-vs/2) + v1/R1 + v1*s*C1 + (v1-va)/ron + gmn*vs/4 =0'
eq3 = 'gm2*v1 + vo/R2 + vo*s*C2 + s*Cc*(vo-va)=0'
[v1,va,vo]=solve(eq1,eq2,eq3,v1,va,vo);

% Define DC gain
Av = gmn*R1*gm2*R2/2; % gm1=gmn/2

% Get Num and Den
[n,d]=numden(vo/vs);
pretty(sort(n)/sort(d));

% Extract the coefficients from Num and Den
n1=n/Av;

b = sym2polys(expand(n1),s);
pretty(b)

a = sym2polys(d,s);
pretty(a)

%% Define circuit constants
gm1=170e-6; gm2=1960e-6;
R1=160e3;R2=19.5e3;Ra=160e3
C1=10e-15;C2=30e-12;Ca=1e-15
gmn=gm1*2; ron=R1/2;
Cc=2e-12;
Rc=1/(2*gmn);
format short e

%% Substitute the constants
b_num=subs(b);
a_num=subs(a);
Av_num=subs(Av);

% Find pole and zero locations
z = roots(b_num)
p = roots(a_num)

% Define AC transfer function
H1=tf(Av_num*b_num,a_num);

%% Plot Spectrum
figure(1)
pzmap(H1)

% Pole zero plot
figure(2)
bode(H1)

Rc
gm1/Cc
```