MathWorks interview question

Calculate control problem