Main Content

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™ supports reading and writing Touchstone 1.1 files and reading Touchstone 2.0 files. (since R2023b)

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 specified in the name-value pair arguments for the file specified in filename. For example, rfwrite(S150,'passive150.s2p','FrequencyUnit','MHz') writes Touchstone file passive150.s2p in MHz using the S-parameters stored in the variable, S150.

Examples

collapse all

Write a new Touchstone file from file default.s2p using data and frequency values. The output is stored in defaultnew.s2p.

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

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

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

Write a Touchstone file passive100.s2p using the new S-parameters.

rfwrite(S100, 'passive100.s2p');

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

S50 = sparameters('passive.s2p');
S150 = newref(S50,150);

Write a Touchstone file passive150.s2p in MHz using the new S-parameters.

rfwrite(S150, 'passive150.s2p','FrequencyUnit', 'MHz');

Convert an existing Touchstone file passive.s2p to Y-parameters.

Y50 = yparameters('passive.s2p');

Write a Touchstone file passive.y2p in MHz using the new Y-parameters.

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.

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.

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.

Data Types: double
Complex Number Support: Yes

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

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

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: 'FrequencyUnit','MHz'

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: 'Parameter','Z'

Data Types: double
Complex Number Support: Yes

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

Example: 'Format', 'MA'

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

Example: 'ReferenceResistance',100

Data Types: double

Flag to suppress the warning message while overwriting an existing file, specified as a comma-separated pair consisting of 'ForceOverwrite' and a logical value. Set 'ForceOverwrite' to true, to overwrite the filename without a warning message.

Example: 'ForceOverwrite',true

Data Types: double

Version History

Introduced in R2014a