5 Functions [10 marks]

Suppose that you have a vector x with three elements that correspond to resistances of 3 resistors.

If the resistors are connected in parallel then the total resistance is equal to \(R\) where:

\[ R = \frac{1}{\dfrac{1}{x_1} + \dfrac{1}{x_2} + \dfrac{1}{x_3}} \]

and \(x_1\), \(x_2\), and \(x_3\) are the three elements in x.

Create a function that computes the total resistance \(R\) given a vector of three resistances. Your function should satisfy the following constraints:

  1. it should be named parallelR
  2. it should return one value R (the total resistance of the values in x as defined by the equation above)
  3. it should have one input value x (a vector with exactly three elements where each element is a resistance value)

5.1 Example usage

% you should be able to compute the correct value of rp by hand
x = [1000 1000 2000];
rp = parallelR(x);