Main Content

circuit

Circuit object

Description

Use circuit object to build a circuit object which can contain elements like resistor, capacitor, and inductor.

Creation

Description

cktobj = circuit creates a circuit object cktobj with a default name.

example

cktobj = circuit(cktname) creates a circuit object cktobj with name of cktname.

cktobj = circuit([elem1,...,elemN]) creates a circuit object cktobj by cascading the specified 2-port elements.

example

cktobj = circuit([elem1,...,elemN],cktname) creates a cascaded circuit object cktobj with the name, cktname.

cktobj = circuit(rfb) creates a circuit object cktobj by cascading the elements in the RF object, rfb.

cktobj = circuit(rfb,cktname) creates a circuit object cktobj by cascading the elements in the RF object, rfb, using name, cktname.

Input Arguments

expand all

2-port RF elements, specified as character vectors. The possible elements are amplifier, nport, and modulator

RF budget object, specified as an object handle.

Properties

expand all

Name of circuit, specified as a character vector. Default name is 'unnamed'. Two circuit elements attached together or belonging to the same circuit cannot have the same name

Data Types: char | string

Heterogeneous array of elements present in the circuit, specified as any one of the following objects: amplifier, resistor, capacitor, inductor, lcladder, nport, modulator, and rffilter objects.

Data Types: char | string

Name of elements in the circuit, specified as a vector of cell vector. The possible elements here are resistor, capacitor, inductor, and circuit.

Data Types: char | string

Names of terminals in the circuit, specified as a cell vector. Use setports or setterminals function to define the terminals. The terminals of the circuit are only displayed once it is defined.

Data Types: char | string

Names of ports in a circuit specified as a character vector. Use setports function to define the ports. The ports of the circuit are only displayed once it is defined.

Data Types: char | string

List of nodes defined in the circuit, specified as a vector of integers. These nodes are created when a new element is attached to the circuit.

Data Types: double

Full path of parent circuit, specified as a character vector. This path appears only once the child circuit is added to the parent circuit.

Data Types: char | string

Nodes of parent circuit, specified as a vector of integers. This vector of integers is the same length as the Terminals property. This property is read-only and appears only after the child circuit is added to the parent circuit.

Data Types: double

Object Functions

sparametersCalculate S-parameters for RF data, network, circuit, and matching network objects
groupdelayGroup delay of S-parameter object or RF filter object or RF Toolbox circuit object
addInsert circuit element or circuit object into circuit
deleteDelete circuit object and decouple its elements
setportsSet ports of circuit object
setterminalsSet terminals of circuit object
cloneCreate copy of existing circuit element or circuit object
richardsConvert lumped element circuit to distributed element circuit using Richards' transformation

Examples

collapse all

Create a circuit called new_circuit. Add a resistor and capacitor to the circuit. Set the terminals and display the results.

hckt = circuit('new_circuit1');
hC1= add(hckt,[1 2],capacitor(3e-9));
hR1 = add(hckt,[2 3],resistor(100));
setterminals (hckt,[1 3]);
disp(hckt)
  circuit: Circuit element

    ElementNames: {'C'  'R'}
        Elements: [1x2 rf.internal.circuit.RLC]
           Nodes: [1 2 3]
            Name: 'new_circuit1'
       Terminals: {'t1'  't2'}

Create a circuit called new_circuit. Add a capacitor and inductor parallel to the circuit.

hckt = circuit('new_circuit');
hC = add(hckt,[1 2],capacitor(1e-12));
hL = add(hckt,[1 2],inductor(1e-9));
disp(hckt)
  circuit: Circuit element

    ElementNames: {'C'  'L'}
        Elements: [1x2 rf.internal.circuit.RLC]
           Nodes: [1 2]
            Name: 'new_circuit'

Create a circuit object. This example uses a four-element circuit.

c = circuit('example_ckt');

Before connecting the elements in a circuit, first use the nport object to create a linear circuit element. The characteristics of the four linear elements are derived from a five-port and one-port Touchstone™ files.

n5 = nport('defaultnew.s5p');
n1 = nport('dipole_antenna.s1p');
n2 = nport('dipole_antenna.s1p');
n3 = nport('dipole_antenna.s1p');

Use the add function to connect the elements of the circuit. First, add the five-port element to the circuit object.

add(c,[1 2 3 4 5],n5)

Add the one-port element n1 to the third terminal of the circuit object.

add(c,[3 0],n1);

Add the one-port element n2 to the fourth terminal of the circuit object.

add(c,[4 0],n2);

Add the one-port element n3 to the fifth terminal of the circuit object.

add(c,[5 0],n3);

Set the ports of the circuit and define the node pairs as [1 2] using the setports function.

setports(c,[1 2]);

Calculate the S-parameters of the circuit.

S = sparameters(c,n5.NetworkData.Frequencies);

Plot the S-parameter data of the circuit using the rfplot function.

rfplot(S)

Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude (dB) contains an object of type line. This object represents dB(S_{11}).

Version History

Introduced in R2013b

expand all