The .net Spice function can be used to calculate two port parameters such as Z,Y,H and S parameters. Zin and Zout can also be calculated.
The circuit below shows a simple example. This is the bans pass filter (BPF).
Here is the LTspice file.
1. Create an input port V1 with a series resistance. The series resistance will typically be 50 Ohm for S-parameters. This resistance will not influence the Z,Y,H parameters or Z in. It will influence the value of Zout. You can choose this value as 0 Ohm for an ideal source.
2. Create an output port with a load resistance Rout. The load resistance will typically be 50 Ohm for S-parameters. This resistance will not influence the Z,Y,H parameters or Zout. It will influence the value of Zin. You can choose this value very high if you don’t have a load.
3. Use the function .net I(Rout) V1 to be able to plot the two port parameters.
4. Run the simulation. Then plot the parameters by using PlotSetting/AddTrace (or CTRL-A) while in the Plot menu.