The current i passing through an electrical resistor having a voltage v across it is given by Ohm’s law: i = vIR, where R is the resistance. The P?w’er dissipated in the resistor is given “‘”‘ by v2/.R. The following table gives data for the resistance and voltage for five resistors. Use the data to compute (a) the current in each resistor and (b) the power dissipatedin each esistor.

Solution

• Solution __ —
(a) First we define two row vectors, one containing the resistance values aha one containing the voltage values. To find the current i =!R using MATLAB, we use array division. The session is

The results are in amperes and should be rounded to three significant figures because the voltage data contains only three significant figures. (b) To find the power P = v2/ R, use array exponentiation and array division. The
session continues as follows:

»power = v.A2./R
power =
1.4400 0.3200 0.3457 0.4000 0.6125

These numbers are the power dissipation in each resistor in watts. Note that the statement v. “2 . / R is equivalent to (v. “2) . / R. Although the rules of precedence are unambiguous here, we can always put parentheses around quantities if we are unsure how MATLAB will interpret our commands