This is machine translation

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

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


Resistor object


Use the capacitor class to create a capacitor object that you can add to an existing circuit.



robj = resistor(rvalue)
robj = resistor(rvalue,rname)



robj = resistor(rvalue) with a resistance of rvalue and default name, R. rvalue must be a numeric non-negative scalar.


robj = resistor(rvalue,rname) creates a resistor object, robj, with a resistance of rvalue and name rname. rname must be a character vector.


expand all

Resistance value specified as a scalar in ohms.

Example: 50

Example: robj.Resistance = 50

Name of resistor object, specified as a character vector. Two elements in the same circuit cannot have the same name.

Example: 'resis'

Example: robj.Name = 'resis'

Names of the terminals of capacitor object, specified as a cell vector. These names are always p and n.

Example: {'p' 'n'}

Example: robj.Terminals = {'p' 'n'}

Full path of the circuit to which the capacitor object belongs, specified as character vector. This path appears only after the capacitor is added to the circuit.


"ParentPath" is only displayed after the capacitor has been added

into a circuit.

Circuit nodes in the parent nodes connect to capacitor terminals, specified as a vector of integers. This property appears only after the capacitor is added to a circuit.

Example: [1 2]

Example: robj.ParentNodes = [1 2]


"ParentNodes" are only displayed after the capacitor has been added

into a circuit.


expand all

Create a resistor of resistance 100 ohms and display its properties.

hR1 = resistor(100);
  resistor: Resistor element

    Resistance: 100
          Name: 'R'
     Terminals: {'p'  'n'}

Create an resistor object and extract the s-parameters of this resistor.

hR = resistor(50,'R50');
hckt = circuit('example2');
add(hckt,[1 2],hR)
setports (hckt, [1 0],[2 0])
freq = linspace (1e3,2e3,100);
S = sparameters(hckt,freq);
  sparameters: S-parameters object

       NumPorts: 2
    Frequencies: [100x1 double]
     Parameters: [2x2x100 double]
      Impedance: 50

  rfparam(obj,i,j) returns S-parameter Sij

Add a resistor to a circuit, display the parent path and parent nodes.

hR = resistor(150,'R150');
hckt = circuit('resistorcircuit');
add(hckt,[1 2],hR)
setports(hckt, [1 0],[2 0])
  resistor: Resistor element

     Resistance: 150
           Name: 'R150'
      Terminals: {'p'  'n'}
    ParentNodes: [1 2]
     ParentPath: 'resistorcircuit'

Introduced in R2013b

Was this topic helpful?