Search for question
Question

4. The script below performs operations (i) through (v) but there are some bugs (errors). Retype the code into your M file, and debug it to find all the errors. For

each error you find, correct it, and describe each error in a comment. Operations: (i) Create row vector X of values 3, 8, 2, 0.2, -4.3, 3.7, and 9.2. (ii) Create row vector Y where each element of Y is the corresponding element squared of X. (iii) Create row vector Z where each element of Z is the corresponding element of X divided by the corresponding element of Y. (iv) Subtract each element of Z from the corresponding element of X and save it in X. (v) Display the transpose of X. Hint: Not every line will have an error. X-3 8 2 0.2 -4.3 3.7 9.2; Y=X^2; Z-X/Y X=X+Z; disp(X');

Fig: 1