10 Creating vectors using functions

There are many MATLAB functions that return vectors or arrays.

Read the help documentation for the MATLAB functions zeros and ones.

help zeros
help ones

Create a new script and save it as q5.m. To the newly created script, add some MATLAB statements that perform the following steps in order:

  1. Creates a \(1 \times 8\) vector of all zeros named z1. Use the function zeros to create the vector.
  2. Creates a \(12 \times 1\) vector of all zeros named z2. Use the function zeros to create the vector.
  3. Creates a \(1 \times 10\) vector of all ones named o1. Use the function ones to create the vector.
  4. Creates a \(6 \times 1\) vector of all ones named o2. Use the function ones to create the vector.