rfwrite

Write RF network data to Touchstone file

Description

example

rfwrite(data,freq,filename) creates a Touchstone data file, filename. rfwrite touchstone files output 16 digits.

Note

RF Toolbox™ does not support Touchstone 2.0 files.

example

rfwrite(netobj,filename) creates a Touchstone file from a network parameter object, netobj.

example

rfwrite(_____,Name,Value) creates a Touchstone file using the options in the name-value pair arguments following the filename.

Examples

Write a Touchstone File Using Data and Frequency Values

Write a new Touchstone file from file default.s2p using data as S50.Parameters and freq as S50.Frequencies. The output is stored in defaultnew.s2p.

S50 = sparameters('default.s2p');
data = S50.Parameters;
freq = S50.Frequencies;
rfwrite(data, freq, 'defaultnew.s2p')

Write a Touchstone File Using Network Object Parameters

Convert an existing Touchstone file passive.s2p to S-parameters with a new resistance value. Write a Touchstone file passive100.s2p using the new S-parameters.

S50 = sparameters('passive.s2p');
S100 = newref(S50,100);
rfwrite(S100, 'passive100.s2p');

Write a Touchstone File Using Name-Value Pair Arguments

Convert an existing Touchstone file passive.s2p to S-parameters with a new resistance value. Write a Touchstone file passive150.s2p in MHz using the new S-parameters.

S50 = sparameters('passive.s2p');
S150 = newref(S50,150);
rfwrite(S150, 'passive150.s2p','FrequencyUnit', 'MHz');

Write a Touchstone File Using Y-Parameters

Convert an existing Touchstone file passive.s2p to Y-parameters. Write a Touchstone file passive.y2p in MHz using the new Y-parameters.

Y50 = yparameters('passive.s2p');
rfwrite(Y50, 'passive.y2p','FrequencyUnit', 'MHz');

Input Arguments

collapse all

Number of ports and frequencies, specified as an N-by-N-by-K matrix, to create Touchstone file. N is the number of ports of data to be written. K is the number of frequencies.

Example: 2x2x20 complex double

Data Types: double
Complex Number Support: Yes

Value of frequencies, specified as a numeric vector of length K, represents the value of frequencies in Hz.

Example: 202 x 1 double

Data Types: double

Name of a Touchstone file, specified as a character vector.

Example: default.s2p

Data Types: char | string

Network parameter object, specified as a scalar, to create Touchstone file. The netobj can be any one of the following types s-parameters, y-parameters, z-parameters, h-parameters, g-parameters, or abcd-parameters.

Example: 1x1 S-parameters

Data Types: double
Complex Number Support: Yes

Name-Value Pair Arguments

Example: rfwrite(S150, 'passive150.s2p','FrequencyUnit', 'MHz')

Optional comma-separated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single quotes ('').

Scaling unit for frequency value, specified as a comma-separated pair consisting of 'Frequency Unit' and any one of the values shown in value summary.

Example: 3.150746640000000e-04

Data Types: double

Network parameter type, specified as a comma-separated pair consisting of 'Parameter' and any one of the values shown in value summary. This pair determines the parameter type the data has to be converted into in the Touchstone file.

Example: 0.0018 + 0.0122i 0.9981 - 0.0127i 0.9984 - 0.0131i 0.0017 + 0.0123i

Data Types: double
Complex Number Support: Yes

File storage format, specified as a comma-separated pair consisting of 'Format' any one of the values shown in value summary. This pair determines the format to store the Touchstone file.

Example: MA

Reference resistance, specified as a comma-separated pair consisting of 'ReferenceResistance' and a positive scalar.

Example: 100

Data Types: double

Introduced in R2014a