(* :Context: Smith` *) (* :Title: Smith *) (* :Author: K.Takeda *) (* :Package Version: 1.0 *) (* :History: original version: February, 1999 *) BeginPackage["Smith`"] SmithChart::usage = "SmithChart[{v11, v12, ...}, {v21, v22, ...}] generates a graphics primitive of the Smith chart, which consists of circles of constant resistance of the values v11, v12, ... and of circles of constant reactance of the values v21, v22, .... " AdmittanceChart::usage = "AdmittanceChart[{v11, v12, ...}, {v21, v22, ...}] generates a graphics primitive of the admittance chart, which consists of circles of the real part being v11, v12, ... and the imaginary part being v21, v22, .... " ImmittanceChart::usage = "ImmittanceChart[{v11, v12, ...}, {v21, v22, ...}] generates a graphics primitive of the immittance chart that consists of SmithChart[v1_List, v2_List] and AdmittanceChart[v1_List, v2_List]. " SmithPlot::usage = "SmithPlot[{v11, v12, ...}, {v21, v22, ...}] plots the Smith chart with circles of constant resistance of the values v11, v12, ... and with circles of constant reactance of the values v21, v22, .... " AdmittancePlot::usage = "AdmittancePlot[{v11, v12, ...}, {v21, v22, ...}] plots the admittance chart with constant circles of the real part being v11, v12, ... and the imaginary part being v21, v22, .... " ImmittancePlot::usage = "ImmittancePlot[{v11, v12, ...}, {v21, v22, ...}] plots the immittance chart. It is equivalent to plot the Smith chart and admittance chart altogether. " Begin["`Private`"] pi = N[Pi] SRCircles[v_List] := Circle[{#/(# + 1), 0}, 1/(# + 1)]& /@ v ARCircles[v_List] := Circle[{-#/(# + 1), 0}, 1/(# + 1)]& /@ v reactance[x_] := Module[{theta0, theta1}, theta0 = Which[x > 0, ArcTan[(1 - x^2)/(2 x)] + pi, x < 0, pi/2 ]; theta1 = Which[x > 0, 3 pi/2, x < 0, ArcTan[(1 - x^2)/(2 x)] + pi ]; Which[Abs[x] < .001, Line[{{-1, 0}, {1, 0}}], Abs[x] >= .001, Circle[{1, 1/x}, 1/Abs[x], {theta0, theta1}] ] ] SICircles[v_List] := reactance /@ N[v] admittance[x_] := Module[{theta0, theta1}, theta0 = Which[x > 0, -pi/2, x < 0, ArcTan[(x^2 - 1)/(2 x)] ]; theta1 = Which[x > 0, ArcTan[(x^2 - 1)/(2 x)], x < 0, pi/2 ]; Which[Abs[x] < .001, Line[{{-1, 0}, {1, 0}}], Abs[x] >= .001, Circle[{-1, 1/x}, 1/Abs[x], {theta0, theta1} ] ] ] AICircles[v_List] := admittance /@ v SmithChart[v1_List, v2_List] := {SRCircles[v1], SICircles[v2]} AdmittanceChart[v1_List, v2_List] := {ARCircles[v1], AICircles[v2]} ImmittanceChart[v1_List, v2_List] := {AdmittanceChart[v1, v2], SmithChart[v1, v2]} SmithPlot[v1_List, v2_List] := Show[Graphics[SmithChart[v1, v2]], PlotRange -> All, AspectRatio -> 1 ] AdmittancePlot[v1_List, v2_List] := Show[Graphics[AdmittanceChart[v1, v2]], PlotRange -> All, AspectRatio -> 1 ] ImmittancePlot[v1_List, v2_List] := Show[Graphics[ImmittanceChart[v1, v2]], PlotRange -> All, AspectRatio -> 1 ] End[] EndPackage[]