urecomcourses1621988quizzes2372423takequestions47123642 You
ure.com/courses/1621988/quizzes/2372423/take/questions/47123642 You only need to include axes, labels, and titles on plots where explicitly asked. ormat output to two decimal places. Use fprintf unless otherwise stated. show partial work. Circle the final answer if it isn\'t clear. You don\'t need to call clear/clc/clf. f you can\'t write the MATLAB code, at least write out the pseudo code. comments are not required, but you may use them to clarify what you were trying to do. Unless explicitly stated otherwise stated, assume \"calculate\" means write a MATLAB program calculate the answer; do not calculate by hand output means what shows up in the command window Question 5 3 pts Give a (brief) description of what\'s wrong with the code (1.5 pts) then fix it by adding or changing lines of code as necessary (1.5 pts). Plot a function (-5, 5, 100) a 3.0; y t cos (t) sin (a) ti HTML Edi EE TT T Font sizes Para
Solution
The problem is with third line. In this line we have:
y = t*cos(t)+sin(a)^t
Here in t*cost(t) both the matrices are of the size 1x100. So we cannot multiply them.
In sin(a)^t, as size of t is 1x100 this is not possible.
We need element wise multiplcation and element wise power.
Right answer:
y = t.*cos(t)+sin(a).^t;
