Compose functions to enforce a power limit

An engineer models a converter supplying a useful electrical load through a resistive cable. These two MATLAB function files are saved in the current folder.


File cableLoss.m:


MATLAB
function loss = cableLoss(current, resistance)
    loss = current^2 * resistance;
end


File supplyPower.m:


MATLAB
function inputPower = supplyPower(outputPower, efficiency)
    inputPower = outputPower / efficiency;
end


The useful load is 480 W, the cable current is 12 A and the converter efficiency is 0.80. The engineer types this composed call at the Command Window:


MATLAB
P = supplyPower(480 + cableLoss(12, 0.35), 0.80)


Find the value MATLAB stores in P, in watts to one decimal place. Then the engineer replaces the resistance argument with a variable R, so the call becomes supplyPower(480 + cableLoss(12, R), 0.80). Find the value of R for which this call returns exactly 690, in ohms to three decimal places.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More User Defined Functions and Function Files Questions: