Main Content

MATLAB Systems Generated from Linear Circuit Wizard

You can use a single Linear Circuit Wizard block to configure one or more MATLAB System blocks to be integrated into a larger Simulink® model. The input and output ports of each MATLAB System block will implement the ports defined in the SPICE netlist and parameter dialog, the block icon will be the Circuit design name specified in the parameter dialog, and the name given to the block in your model will be the Block name specified in the parameter dialog. Each MATLAB System block will have a fixed step discrete sample time that can either be inherited from another block in the model or set by the MATLAB System block itself.

Verify MATLAB System Block Configuration

Define and verify the configuration of a MATLAB System block in the Linear Circuit Wizard before building it. You can also use the Linear Circuit Wizard to modify the configuration of a MATLAB System block that it has already constructed by setting Block name to the name of the block to be modified.

You can verify the Circuit design name, Block name, Netlist file name, port definitions, and device noise generators. You can also verify the response of the block using either transfer function plots or a transfer function pole/zero report. Both options are available as soon as the netlist file is parsed and at least one output port is defined.

Plot transfer functions: Click the Plot transfer functions button to obtain a plot of all of the transfer functions the block will implement. This produces a figure window with a separate tab for each output port. Each output port tab plots the transfer function magnitude from each input port and device noise generator to that output port. The plot scale is decibels of gain versus log frequency, making it easier to identify approximate pole and zero locations as well as overall gain.

Export poles and zeros: Click the Export poles and zeros button to obtain a report of the transfer function poles and zeros. This produces the struct array LinearCircuitWizardPoleZero in your base workspace. The fields of each struct are:

  • Poles: A row vector of complex pole locations in the Laplace domain

  • Zeros: A cell matrix in which each cell is a row vector of complex zero locations in the Laplace domain, one for each channel through the block

  • Gains: A matrix of real-valued gains, one for each channel through the block

Build MATLAB System Block

To configure a new or existing MATLAB System block to reflect the configuration currently defined in the Linear Circuit Wizard, click the Build/modify block button. If in doubt, look for a warning message in the Linear Circuit Wizard parameter dialog indicating that the block does not reflect the current configuration. Clicking the Build/modify block button will resolve the warning.

Sample Time

The sample time of the MATLAB System block is specified in terms of a sample rate (frequency) rather than directly as a sample time. You can configure the sample time of the MATLAB System block through its parameter dialog. The default condition is for the block to inherit its sample time. To set the sample time of the block directly, disable Inherit sample rate from input. This enables the Sample rate parameter. Set the sample rate to the desired frequency.

MATLAB System blocks configured by the Linear Circuit Wizard often model analog circuits that are combined with other blocks that model digital circuits. Whereas analog circuits are usually modeled using a fixed step discrete sample time, digital circuits are usually modeled using a variable step discrete sample time. For more information on combining fixed step discrete sample time with variable step discrete sample time, see the example Digital Timing Using Fixed Step Sampling.

See Also

Related Topics