Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

add

Insert circuit element or circuit object into circuit

Syntax

add(cktobj,cktnodes,elem)
add(cktobj,cktnodes,elem,termorder)
elem = add(_____)

Description

example

add(cktobj,cktnodes,elem) inserts a circuit element elem into a circuit object cktobj. The terminals of the elem are attached to the nodes specified in cktnodes. If elem is a Touchstone file name or s-parameters object, an nport object is created from input and added to cktobj.

example

add(cktobj,cktnodes,elem,termorder) the terminals specified in termorder are attached to circuit nodes specified in cktnodes.

example

elem = add(_____) returns elem as an output.

Examples

collapse all

Create a resistor, and add it to a circuit.

hR1 = resistor(50);
hckt1 = circuit('new_circuit1');
add(hckt1,[1 2],hR1)
disp(hR1)
disp(hckt1)
  resistor: Resistor element

     Resistance: 50
           Name: 'R'
      Terminals: {'p'  'n'}
    ParentNodes: [1 2]
     ParentPath: 'new_circuit1'

  circuit: Circuit element

    ElementNames: {'R'}
           Nodes: [1 2]
            Name: 'new_circuit1'

Create a capacitor.

hC2 = capacitor(1e-10)
disp(hC2)
hC2 = 

  capacitor: Capacitor element

    Capacitance: 1.0000e-10
           Name: 'C'
      Terminals: {'p'  'n'}

  capacitor: Capacitor element

    Capacitance: 1.0000e-10
           Name: 'C'
      Terminals: {'p'  'n'}

Connect terminal n of the capacitor to node 3 and terminal p of the capacitor to node 4.

hckt2 = circuit('new_circuit2');
add(hckt2,[3 4],hC2,{'n' 'p'})
disp(hckt2)
  circuit: Circuit element

    ElementNames: {'C'}
           Nodes: [3 4]
            Name: 'new_circuit2'

Create a circuit.

hckt3 = circuit('new_circuit3')
hckt3 = 

  circuit: Circuit element

    ElementNames: {}
           Nodes: []
            Name: 'new_circuit3'

Insert an inductor into the circuit using the add function.

hL3 = add(hckt3,[100 200],inductor(1e-9));
disp(hckt3)
  circuit: Circuit element

    ElementNames: {'L'}
           Nodes: [100 200]
            Name: 'new_circuit3'

Create circuit 1 and set the terminals using the setterminals functions.

hckt1 = circuit('circuit_new1');
add(hckt1,[1 2], resistor(100));
setterminals(hckt1, [1 2]);
disp(hckt1);
  circuit: Circuit element

    ElementNames: {'R'}
           Nodes: [1 2]
            Name: 'circuit_new1'
       Terminals: {'t1'  't2'}

Create circuit 2 and set the terminals.

hckt2 = circuit('circuit_new2');
add(hckt2, [3 4], capacitor(1.5e-9));
setterminals(hckt2, [3 4]);
disp(hckt2);
  circuit: Circuit element

    ElementNames: {'C'}
           Nodes: [3 4]
            Name: 'circuit_new2'
       Terminals: {'t1'  't2'}

Add the two circuits.

add(hckt1, [2 4], hckt2);
disp(hckt2)
disp(hckt1)
  circuit: Circuit element

    ElementNames: {'C'}
           Nodes: [3 4]
            Name: 'circuit_new2'
       Terminals: {'t1'  't2'}
     ParentNodes: [2 4]
      ParentPath: 'circuit_new1'

  circuit: Circuit element

    ElementNames: {'R'  'circuit_new2'}
           Nodes: [1 2 4]
            Name: 'circuit_new1'
       Terminals: {'t1'  't2'}

Input Arguments

collapse all

Circuit object into which the circuit element is inserted, specified as scalar handle object. This circuit object can be a new circuit or a nport object, or an already existing circuit.

Circuit nodes of the circuit object, specified as vector of integers. The function uses this input argument to attach the new element to the circuit.

Circuit elements that are inserted into the circuit object, specified as scalar handle objects. The element can be a resistor, capacitor, inductor, Touchstone file name, s-parameter object, or an entire circuit.

Element terminals, which are the same scalar handle objects found in Terminals property of elem. These input arguments are specified as scalar handle objects. .

Output Arguments

collapse all

Circuit elements, which are returned as scalar handle objects, after using the add function. The function uses any or all of the input arguments to create these circuit element.

Introduced in R2013b

Was this topic helpful?