# Lab MatLab

March 17th, 2023

I dont understand this Computer Science question and need help to study.

Don't use plagiarized sources. Get Your Custom Essay on

Lab MatLab

From $8/Page

**Lab 2: ****Vectors**** ****and**** ****Matrices**

**Tasks**

- Using a built-in function, create a vector
*vec*, which consists of 30 equally spaced points in the range from 2? to +?.

- Write an expression using
**linspace**that will result in the same as 1: 0.5: 3

- Using the colon operator and the transpose operator, create a column vector
*myvec*that has the values -1 to 1 in steps of 0.5.

- Create a
*3 x 5*matrix of random real numbers.Delete the third row.

- Create a three-dimensional matrix with dimensions 2 x 4 x 3 in which the first layer is all 0s, the second is all 1s and the third is all 5s.Use
**size**to verify the dimensions.

- Create a
*1 x 6*vector of random integers, each in the inclusive range from 1 to 20.Use built-in functions to find the minimum and maximum values in the vector.Also create a vector of cumulative sums using**cumsum**.

- A company is calibrating some measuring instrumentation and has measured the radius and height of one cylinder 8 separate times; they are in vector variables
*r*and*h*.Find the volume from each trial, which is given by ?r^{2}h.

r/cm |
5.499 |
5.498 |
5.5 |
5.5 |
5.52 |
5.51 |
5.5 |
5.18 |

h/cm |
11.1 |
11.12 |
11.09 |
11.11 |
11.11 |
11.11 |
11.08 |
11.11 |