main content

write s2p touchstone files -凯发k8网页登录

this example shows how to write the data in a circuit object created in the matlab® workspace into an industry-standard data file, touchstone®. you can use these files in third-party tools.

to write a touchstone file, in this example an rlgc transmission line object is created and analyzed in the frequency domain. this analyzed results are written into a touchstone file and the data is compared with the original result.

create rf circuit object to represent an rlcg transmission line

create a object to represent a rlcg transmission line. this example uses name-value pairs to implement the parameters in the rlcg transmission line shown in figure 1 [1].

rlcg_transmission_line.png

figure 1: rlcg transmission line.

ckt1 = txlinerlcgline('r',100,'l',80e-9,'c',200e-12,'g',1.6);

clone circuit object

use the function to make a copy of the transmission line object.

ckt2 = clone(ckt1)
ckt2 = 
  txlinerlcgline: rlcgline element
           name: 'rlcgline'
      frequency: 1.0000e 09
              r: 100
              l: 8.0000e-08
              c: 2.0000e-10
              g: 1.6000
       intptype: 'linear'
     linelength: 0.0100
    termination: 'notapplicable'
       stubmode: 'notastub'
       numports: 2
      terminals: {'p1 '  'p2 '  'p1-'  'p2-'}

cascade two circuit objects

use the circuit object to cascade the two transmission lines.

ckt = circuit([ckt1,ckt2]);

analyze and plot s-parameter data

use the sparameters object to analyze the cascadeed transmission line in the frequency domain.

freq = linspace(0,10e9);
ckt_sparameters = sparameters(ckt,freq);

use the method to plot the object's s11 on a smith chart®.

figure
smithplot(ckt_sparameters,[1,1],'legendlabels','s11 original')

write data to s2p file

use the function to write the data to a file.

workingdir = tempname;
mkdir(workingdir);
filename = fullfile(workingdir,'myrlcg.s2p');
if exist(filename,'file')
    delete(filename)
end
rfwrite(ckt_sparameters,filename);

compare data

read the data from the file myrlcg.s2p into a new sparameters object and plot input reflection coefficient, s11 on a smith chart. visually compare the 's11 original' and 's11 from s2p' to confirm that the data matches.

compare_ckt = sparameters(filename);
figure
smithplot(compare_ckt,[1,1],'legendlabels','s11 from s2p')

[1] m. steer, "transmission lines," in microwave and rf design: transmission lines. vol. 2, 3rd ed. raleigh, north carolina, us: north carolina state university, 2019, ch. 2, sec. 2, pp.58.

related topics

    网站地图