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.

setports

Set ports of circuit object

Syntax

setports(cktobj,nodepair_1,......,nodepair_n)
setports(cktobj,nodepair_1,......,nodepair_n,portnames)

Description

example

setports(cktobj,nodepair_1,......,nodepair_n) defines the node_pairs in an N-port cktobj as ports using nodepair_1,......,nodepair_n. This syntax then assigns the ports default names. It also defines the terminals of a cktobj, taking the terminal names from the port names. If any of the node pairs do not exist, setports creates it.

example

setports(cktobj,nodepair_1,......,nodepair_n,portnames) defines the node_pairs in an N-port cktobj as ports using nodepair_1,......,nodepair_n. After defining the ports, this syntax names them using portnames. The length of the portnames must equal to the number of node_pairs in the circuit.

Examples

collapse all

Create a 1-port circuit using setports.

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

    ElementNames: {'R'}
           Nodes: [1 2]
            Name: 'new_circuit1'
        NumPorts: 1
       Terminals: {'p1+'  'p1-'}

Create a circuit and define two ports. Name the ports in and out.

 hckt2 = circuit('example_circuit2');
 add(hckt2,[2 3],resistor(50))
 add(hckt2,[3 1],capacitor(1e-9))
 setports(hckt2,[2 1],[3 1],{'in' 'out'})
 disp(hckt2)
  circuit: Circuit element

    ElementNames: {'R'  'C'}
           Nodes: [1 2 3]
            Name: 'example_circuit2'
        NumPorts: 2
       Terminals: {'in+'  'out+'  'in-'  'out-'}

Input Arguments

collapse all

Circuit object for which the ports are defined, specified as scalar handle objects.

Node pairs of the circuit object, specified as vector of integers. The function uses this input argument to define the ports.

Names to name the ports defined for the circuit object, specified as character vector.

Introduced in R2013b

Was this topic helpful?