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.

ThreeStageIndirectCompensation_Class_A.m
```%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Indirect Feedback Reverse Nested Compensation of 3-Stage Opamp
% Class-A Output Stage (MS Thesis Pg. 101, Fig. 3-28)
% Pole-Zero Cancelled, CL=30pF.
% Vishal Saxena
% Boise State University
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all; clc;
%% Define the circuit symbols here
syms s vs v1 v2 vo s R1 R2 R3 Rc1 Rc2 gm1 gm2 gm3 gmc1 gmc2 C1 C2 Cc1 Cc2 k1 k2;
% Nodal Analysis Equations
eq1 = '-gm1*vs + v1/R1 + v1*s*C1 - v2/(1/(s*Cc1)+Rc1)+ vo/(1/(s*Cc2)+Rc2)=0'
eq2 = 'gm2*v1 + v2/R2 + v2/(1/(s*Cc1)+Rc1) + v2*s*C2=0'
eq3 = 'gm3*v2 + vo/R3 + vo/(1/(s*Cc2)+Rc2) + vo*s*C3=0'
[v1,v2,vo]=solve(eq1,eq2,eq3,v1,v2,vo);

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

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

% Extract the coefficients from Num and Den
Av = gm1*R1*gm2*R2*gm3*R3;
n1=n/Av;

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

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

%% Define circuit constants
gm1=170e-6; gm2=170e-6;gm3=2.4e-3;
R1=130e3;R2=130e3;R3=13e3;
C1=10e-15;C2=17.2e-15;C3=30e-12;
Cc1=1e-12;Cc2=2e-12;
Rc0 = 1/(2*gm1);

%% Apply pole-zero cancellation criterion
Rc1 = C3/(gm3*Cc2);
Rc2 = (Cc1/Cc2^2)*((C3+Cc2)/gm3);

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)
h1=pzplot(H1);
setoptions(h1,'FreqUnits','Hz');

% Pole zero plot
figure(2)
h2=bodeplot(H1);
setoptions(h2,'FreqUnits','Hz');
grid on;

R1c=Rc1-Rc0
R2c=Rc2-Rc0
fun=gm1/(2*pi*Cc2)
p45 = - (gm3*Cc2/C3)*sqrt(gm2*R2*Cc2/(C1*C2*Cc1)) ```