rfwrite
Write RF network data to Touchstone® file
Description
rfwrite(_____,
creates a
Touchstone file using the options specified in the name-value pair arguments for the file
specified in Name,Value
)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
Write Touchstone File Using Data and Frequency Values
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')
Write Touchstone File Using Network Object Parameters
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');
Write Touchstone File Using Name-Value Pair Arguments
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');
Write Touchstone File Using Y-Parameters
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
data
— Number of ports and frequencies
matrix
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
freq
— Value of frequencies
numeric vector
Value of frequencies, specified as a numeric vector of length K
,
represents the value of frequencies in Hz.
Data Types: double
filename
— Name of Touchstone file
character vector | string scalar
Name of a Touchstone file, specified as a character vector.
Example: default.s2p
Data Types: char
| string
netobj
— Network parameter object
scalar
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')
FrequencyUnit
— Scaling unit for frequency values
'GHz'
(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: 'FrequencyUnit','MHz'
Data Types: double
Parameter
— Network parameter type
'S'
(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:
'Parameter','Z'
Data Types: double
Complex Number Support: Yes
Format
— File storage format
'MA'
(default) | 'DB'
| 'RI '
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'
ReferenceResistance
— Resistance
50
(default) | positive scalar (Ohm)
Reference resistance, specified as a comma-separated pair consisting of
'ReferenceResistance'
and a positive scalar.
Example: 'ReferenceResistance',100
Data Types: double
ForceOverwrite
— Flag to suppress the warning message while overwriting existing file
false
(default) | true
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
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)