Export Component Data to a File

Available Export Formats

RF Toolbox™ software lets you export data from any rfckt object or from an rfdata.data object to industry-standard data files and MathWorks® AMP files. This export capability lets you store data for use in other simulations.

Note

The toolbox also lets you export data from an rfmodel object to a Verilog-A file. For information on how to do this, see Export a Verilog-A Model.

You can export data to the following file formats:

  • Industry-standard file formats — Touchstone SNP, YNP, ZNP, HNP, and GNP formats specify the network parameters and noise information for measured and simulated data.

    For more information about Touchstone files, see https://ibis.org/connector/touchstone_spec11.pdf.

  • MathWorks amplifier (AMP) file format — Specifies amplifier network parameters, output power versus input power, noise data and third-order intercept point.

    For more information about .amp files, see AMP File Data Sections.

How to Export Object Data

To export data from a circuit or data object, use a write command of the form

status = write(obj,'filename');

where

  • status is a return value that indicates whether the write operation was successful.

  • obj is the handle of the circuit or rfdata.data object.

  • filename is the name of the file that contains the data.

For example,

status = write(rfckt.amplifier, 'myamp.amp');

exports data from an rfckt.amplifier object to the file myamp.amp.

Export Object Data

In this example, use the toolbox to create a vector of S-parameter data, store it in an rfdata.data object, and export it to a Touchstone file.

At the MATLAB® prompt:

  1. Type the following to create a vector, s_vec, of S-parameter values at three frequency values:

    s_vec(:,:,1) = ...
        [-0.724725-0.481324i, -0.685727+1.782660i; ...
          0.000000+0.000000i, -0.074122-0.321568i];
    s_vec(:,:,2) = ...
        [-0.731774-0.471453i, -0.655990+1.798041i; ...
          0.001399+0.000463i, -0.076091-0.319025i];
    s_vec(:,:,3) = ...
        [-0.738760-0.461585i, -0.626185+1.813092i; ...
          0.002733+0.000887i, -0.077999-0.316488i];
  2. Type the following to create an rfdata.data object called txdata with the default property values:

    txdata = rfdata.data;
  3. Type the following to set the S-parameter values of txdata to the values you specified in s_vec:

    txdata.S_Parameters = s_vec;
  4. Type the following to set the frequency values of txdata to [1e9 2e9 3e9]:

    txdata.Freq=1e9*[1 2 3];
  5. Type the following to export the data in txdata to a Touchstone file called test.s2p:

    write(txdata,'test')