00001 // filter.cc: 00002 // 00003 // The following code builds a 2 GHz maximally flat low-pass filter. 00004 // See Pozar, page 489. 00005 00006 #include "supermix.h" 00007 00008 int main() 00009 { 00010 device::T = 295. * Kelvin; 00011 device::Z0 = 50. * Ohm; 00012 00013 capacitor c1; 00014 c1.parallel(); 00015 c1.C = 0.984 * pFarad; 00016 00017 inductor l2(6.438*nHenry); 00018 l2.series(); 00019 00020 capacitor c3; 00021 c3.parallel(); 00022 c3.C = 3.183 * pFarad; 00023 00024 inductor l4 = l2; 00025 capacitor c5(c1); 00026 00027 circuit filter; 00028 int input = filter.add_port(c1, 1); 00029 int output = filter.add_port(c5, 2); 00030 filter.connect(c1, 2, l2, 1); 00031 filter.connect(l2, 2, c3, 1); 00032 filter.connect(c3, 2, l4, 1); 00033 filter.connect(l4, 2, c5, 1); 00034 00035 cout << fixed << setprecision(3); 00036 cout << "2 GHz low-pass filter" << endl << endl; 00037 cout << "F(GHz)" << "\t" << "S21" << "\t" << "Phase" << endl; 00038 00039 complex::out_degree(); 00040 complex::out_separator("\t"); 00041 00042 for(double f=0.25; f<5.0; f+=0.25) { 00043 device::f = f*GHz; 00044 sdata response = filter.get_data(); 00045 complex S21 = response.S[output][input]; 00046 cout << device::f/GHz << "\t" << S21 << endl; 00047 } 00048 00049 }
Please direct comments and corrections to
supermix@submm.caltech.edu
Go to the supermix home page
Generated by
1.2.7