12 Resistors 6

When two resistors with resistances \(R1\) and \(R2\) are connected in series, the total resistance is equal to \(R = R1 + R2\).

In MATLAB, create a new function named seriesR that computes the total resistance of two resistors connected in series. The function should satisfy all of the following requirements:

  1. it should return a value named R equal to the series resistance of the two input resistance values
  2. it should be named seriesR
  3. it should have two input variables called R1 and R2 that represent the resistances of the two resistors
  4. it should contain a meaningful documentation comment
  5. it should compute and return the series resistance of the two resistors

Save your function. Test your function in the MATLAB Command Window using some randomly chosen values of R1 and R2; for example, try calling your function as shown below and verify that your function returns the correct series resistance:

R = seriesR(0, 0)
R = seriesR(0, 100)
R = seriesR(100, 0)
R = seriesR(100, 200)