rfwrite

Write RF network data to Touchstone file

Syntax

Description

example

rfwrite(data,freq,filename) creates a Touchstone data file, filename.

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

expand all

data — Number of ports and frequenciesmatrix

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

freq — Value of frequenciesnumeric vector

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

filename — Name of Touchstone filestring

Name of a Touchstone file, specified as a string.

Example: default.s2p

Data Types: char

netobj — Network parameter objectscalar

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 ('').

'FrequencyUnit' — Scaling unit for frequency valuesGHz (default) | Mhz | KHz | Hz

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

'Parameter' — Network parameter typeS (default) | Y | Z | h | g

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

'Format' — File storage formatMA (Magnitude Angle) (default) | DB (Decibel) | RI (Real Imaginary)

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

'ReferenceResistance' — Resistance50 (default) | positive scalar (Ohm)

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

Example: 100

Data Types: double

See Also

| | |

Was this topic helpful?