Homework assignment Matlab/Octave

 

Part A.

1.      Construct a vector A of size 10 and values 1,2, 3… .

2.      Construct a vector B of size 10 and random values between -1 and 1, uniformly distributed.

3.      Compute A+B, and A-B

4.      Multiply each element of A with each element of B and save the result in a vector C;

5.      Create a matrix D of (10,3) having as columns vectors A, B, and C.

6.      Write a piece of code that replaces all odd numbers in matrix C with 10000.

 

Part B.

1.      Load the iris dataset.

2.      The columns of each dataset in iris represent sepal length, sepal width, petal length, petal width. Display mean values of petal length for each iris variety.

3.      Which iris variety has the longest petal?

4.      Which iris variety has the shortest sepal?

5.      Display a scatter plot of petal length/petal width for each variety. Use different colors and symbols in each plot.

6.      Which variety has the strongest correlation between sepal length and petal length?

7.      Display boxplots with the values of each characteristic for the three species (4 boxplots with 3 boxes each).