Laser Locking HF Compensation
T1200477-v1

Setup

Needs["Controls`LinearControl`"]

$TextStyle={FontFamily->"Helvetica",FontSize->13};

plotopt=PlotStyle->{{Thickness [0.007], RGBColor [1,0,0]},
			    {Thickness [0.007], RGBColor [0,0,1]},
			    {Thickness [0.007], RGBColor [0.1,0.7,0.2]},
			    {Thickness [0.007], RGBColor [0.5,0.5,0.2]}};

par[r1_,r2_]:=(1/(1/r1+1/r2))

pole[f_,p_]:=(1/(1+I f/p))
zero[f_,p_]:=1+I f/p
pole[f_,p_,Q_]:=(1/(1+I(1/Q)(f/p)-(((f/p))^2)))
zero[f_,p_,Q_]:=1+I(1/Q)(f/p)-(((f/p))^2)

Read Transfer Function

path="Desktop/";

oltf={#[[1]]/1000.,#[[2]](E^(I#[[3]]))}&/@Transpose[Append[Transpose[{#[[1]],(10^(#[[2]]/20))}&/@Import[path <>"LL_TFmag.txt", "Table"]],
#[[2]]°&/@Import[path<>"LL_TFpha.txt", "Table"]]];
oltfunc=Interpolation[oltf];

BodePlotEx[oltfunc[f],{f,10,1000},plotopt,BaseStyle->$TextStyle,XAxisLabel->"kHz",MagnitudeRange->{-50,0},PhaseRange->{-250,50}]

Target

Single pole

tf=(10^(10.4/20))pole[f,80] oltfunc[f];
BodePlotEx[tf,{f,10,1000},plotopt,BaseStyle->$TextStyle,XAxisLabel->"kHz",MagnitudeRange->{-40,10},PhaseRange->{-250,50}]
Print["Amplitude at 30kHz = ", dB[tf/.f->30]," dB"];Print ["Phase at 30kHz = ",Phase[tf/.f->30] ,"°"];
Print["Amplitude at 280kHz = ", dB[tf/.f->280]," dB"];

Double pole

tf=(10^(9.7/20))pole[f,100, 0.85] oltfunc[f];
BodePlotEx[tf,{f,10,1000},plotopt,BaseStyle->$TextStyle,XAxisLabel->"kHz",MagnitudeRange->{-40,10},PhaseRange->{-250,50}]
Print["Amplitude at 30kHz = ", dB[tf/.f->30]," dB"];Print ["Phase at 30kHz = ",Phase[tf/.f->30] ,"°"];
Print["Amplitude at 280kHz = ", dB[tf/.f->280]," dB"];

Sallen-Key

Filter components

SKval={R1->m R,R2->R,C1->n C,C2->C};

Filter equations

eq1 = f0==(1/(2π R C(Sqrt[m n])))
eq2=Q==((Sqrt[m n])/(m+1))
eq3=n==3.3

Determine at n and m

msol=Chop[Solve[{eq2},{m}]/.Q->0.85/.n->3.3]

Values

Solve[{eq1},{R}][[1]]/.f0->100*^3/.n->3.3/.C->470*^-12/.msol
(R/.%)(m/.msol)

Parameters

prm={C1->1.5*^-9,C2->470*^-12,R1->2.7*^3,R2->1.3*^3}
((1*^-3)/(2π (Sqrt[R1 R2 C1 C2])))/.prm
((Sqrt[R1 R2 C1 C2])/(C2(R1+R2)))/.prm