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_Simplified_Model.m
```%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Indirect Feedback Compensation of 2-Stage Opamp
% Simplified Generic Topology (MS Thesis Pg. 31, Fig. 2-21)
% CL=30pF.
% Vishal Saxena
% Boise State University
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all; clc;
%% Define the circuit symbols here
syms s vs v1 vo s R1 R2 Rc gm1 gm2 gmc C1 C2 Cc;
% Nodal Analysis Equations
eq1 = '-gm1*vs + v1/R1 + v1*s*C1 - vo*(gmc*Rc)/(1/(s*Cc)+Rc)=0'
eq2 = 'gm2*v1 + vo/R2 + vo/(1/(s*Cc)+Rc) + vo*s*C2=0'
[v1,vo]=solve(eq1,eq2,v1,vo);

% Define DC gain
Av = -gm1*R1*gm2*R2;

% 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(n1,s);
pretty(b')

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

%% Define circuit constants
gm1=170e-6; gm2=1960e-6;
R1=160e3;R2=19.5e3;
C1=10e-15;C2=30e-12;
Cc=2e-12;
gmc=gm1;Rc=1/gmc;
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
```