Main Content

setterminals

Set terminals of circuit object

Description

example

setterminals(cktobj,cktnodes) defines the nodes in a cktobj as terminals using cktnodes. It then gives the terminals default names.

example

setterminals(cktobj,cktnodes,termnames) defines the nodes in a cktobj as terminals cktnodes. It then names the terminals using termnames. cktnodes and termnames must be same length.

Examples

collapse all

Create a circuit names new_circuit1.

hckt1 = circuit('new_circuit1');

Add a resistor and capacitor to the circuit.

add(hckt1,[1 2],resistor(50));
add(hckt1,[2 3],capacitor(1e-9));

Set the terminals of the circuit.

setterminals(hckt1,[1 3])
disp(hckt1)
  circuit: Circuit element

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

Create a circuit and add three resistors to it.

hckt2 = circuit('example_circuit2');
add(hckt2,[1 2],resistor(50));
add(hckt2,[1 3],resistor(50));
add(hckt2,[1 4],resistor(50));

Set terminals of the circuit by using (a, b, c) as termnames.

setterminals(hckt2,[2 3 4],{'a' 'b' 'c'})
disp(hckt2)
  circuit: Circuit element

    ElementNames: {'R'  'R_1'  'R_2'}
        Elements: [1x3 resistor]
           Nodes: [1 2 3 4]
            Name: 'example_circuit2'
       Terminals: {'a'  'b'  'c'}

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'}
        Elements: [1x1 resistor]
           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'}
        Elements: [1x1 capacitor]
           Nodes: [3 4]
            Name: 'circuit_new2'
       Terminals: {'t1'  't2'}

Add the two circuits.

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

    ElementNames: {'C'}
        Elements: [1x1 capacitor]
           Nodes: [3 4]
            Name: 'circuit_new2'
       Terminals: {'t1'  't2'}
     ParentNodes: [2 4]
      ParentPath: 'circuit_new1'
disp(hckt1)
  circuit: Circuit element

    ElementNames: {'R'  'circuit_new2'}
        Elements: [1x2 rf.internal.circuit.Element]
           Nodes: [1 2 4]
            Name: 'circuit_new1'
       Terminals: {'t1'  't2'}

Input Arguments

collapse all

Circuit object for which the terminals are defined, specified as a scalar handle object.

Circuit nodes, used by the function to define the terminals of the circuit, specified as a vector of integers.

Names, used to identify the terminals defined for the circuit object, specified as a character vector.

Version History

Introduced in R2013b