Question: This is a homework for MATLAB. Please answer using MATLAB functions and parameters. The answers are to be submitted as a .m script. Don't just

This is a homework for MATLAB. Please answer using MATLAB functions and parameters. The answers are to be submitted as a .m script. Don't just list final answers.

Problem 1: a) Using function linspace, create a row vector p1a to include all odd integer numbers starting 1 and ending at 999.

b) Using colon operator, create a row vector p1b to include all even integer numbers starting from 2 and ending at 998.

c) Combine the vectors created in parts (a) and (b) into to a longer vector p1c. Put part (a) first, then part (b).

d) What is the length of the vector in part (c) ? Put the answer to p1d.

e) Which element of the vector in part (c) is the number 100? Use function find. Put the answer to p1e.

f) Add the number 0 at the beginning of the vector in part (c) to create vector p1f.

g) Write an expression to extract the second quarter of the vector in part (f) into vector p1g.

h) Write an expression to extract the fourth quarter of the vector in part (f) into vector p1h.

i) Create a column vector p1i to list all even numbers from -2 to -2000. The vector should be listed in decreasing order.

j) Find the cube root of all of the elements of the vector in part (i) and put the answer in p1j.

k) Sum the first ten elements of the vector in part (i) and put the answer in p1k.

l) Find the product of the last ten elements of the vector in part (i) and put the answer in p1l.

m) Find the cumulative sum of the vector in part (i). Put the answer in p1m

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!