Question: can you find the errors for each Instructions: Answer Question 1 using the given answer template. There are 8 printed pages for this question. Open


can you find the errors for each
Instructions: Answer Question 1 using the given answer template. There are 8 printed pages for this question. Open book test. a) Given three vectors, VecT=[300 285 270 255 240], VecP=[1 1.5 2.0 2.5 3.0], VecZ= [1.5 3.2 4.4 5.1] Four different MATLAB commands involved vector VecT, VecP and VecZ was executed in the command window below. However, the commands have errors. Identify the errors and write the correct commands in given empty spaces to produce the correct answer given as (10 Marks) ans. >> Vect =linspace (300,240,5); >> VecP=[1:0.5:3] >> VecT*VecP or sing * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use ans- 300.0000 427.5000 540.0000 637.5000 720.0000 >> VecP=[1:0.5:3] >> VecZ= [1.5 3.2 4.4 5.1]; >> VecP+VecZ Matrix dimensions must agree. >> >>> ans = 2.5000 4.7000 6.4000 7.6000 >> Vect =linspace (300, 240,5); >> Vecz= (1.5 3.2 4.4 5.1); >> Vect Vec2 Error using Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use ans 3.8505e+03 >>table (VecP Vect, 'VariableNames', { "Vecp', 'Vect' }) + Error: Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses. ans 5x2 table Vect 1 300 1.5 285 2 270 255 2.5 3 240
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
