prints out a few more design params
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 29 Nov 2015 06:16:11 +0000 (06:16 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 29 Nov 2015 06:16:11 +0000 (06:16 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2496 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/s_param_rf.m

index a923ccee1dff6d8bd00264e59138c37be4995233..b169e48aaaad8c20f3f51eb6786faa2acda1c852 100644 (file)
@@ -80,7 +80,8 @@ scAddPoint(zo);
   % Now convert to real component values
 
   w = 2*pi*150E6;
-  Ls = Xs/w;
+  Ls = Xs/w; diameter_mm = 6.25; 
+  Ls_turns = design_inductor(Ls*1E6, diameter_mm);
   Cp = 1/(w*(-Xp_match));
 
   printf("Input: Zi = %3.1f + %3.1fj ohms\n", real(Zi), imag(Zi));
@@ -89,16 +90,20 @@ scAddPoint(zo);
   printf("       Rs = %3.1f to Rl = %3.1f ohm matching network Xs = %3.1fj Xp = %3.1fj\n", Rs, Rl, Xs, Xp);
   printf("       with conj match to Zi Xs = %3.1fj Xp = %3.1fj\n", Xs, Xp_match);
   printf("       matching components Ls = %5.3f uH Cp = %4.1f pF\n", Ls*1E6, Cp*1E12);
+  printf("       Ls can be made from %3.1f turns on a %4.2f mm diameter air core\n", Ls_turns, diameter_mm);
 
 % Now Z match for output
 
   Lo = -imag(Zo)/w;
+  Lo_turns = design_inductor(Lo*1E6, diameter_mm);
   printf("Output: Zo = %3.1f + %3.1fj ohms\n", real(Zo), imag(Zo));
   printf("        So for a conjugate match transistor output wants to see:\n          Rl = %3.1f Xl = %3.1fj ohms\n", real(Zo), -imag(Zo));
   printf("        Which is a series inductor Lo = %5.3f uH\n", Lo*1E6);
+  printf("        Lo can be made from %3.1f turns on a %4.2f mm diameter air core\n", Lo_turns, diameter_mm);
 
 % Helper functions -------------------------------------------------
 
+
 % convert a parallel R/X to a series R/X
 
 function Zs = zp_to_zs(Zp)
@@ -106,6 +111,7 @@ function Zs = zp_to_zs(Zp)
   Zs = Xp*Rp/(Xp+Rp);
 endfunction
 
+
 % convert a series R/X to a parallel R/X
 
 function Zp = zs_to_zp(Zs)
@@ -116,6 +122,7 @@ function Zp = zs_to_zp(Zs)
   Zp = Rp + j*Xp;
 endfunction
 
+
 % Design a Z match network with a parallel and series reactance
 % to match between a low and high resistance:
 %
@@ -132,3 +139,9 @@ function [Xs Xp] = z_match(Rlow, Rhigh)
   Xp = -Rhigh/Q; 
 endfunction
 
+
+% Design an air core inductor, Example 1-5 "RF Circuit Design"
+
+function Nturns = design_inductor(L_uH, diameter_mm)
+  Nturns = sqrt(29*L_uH/(0.394*(diameter_mm*0.1/2)));
+endfunction