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:
- Creates a \(1 \times 8\) vector of all zeros named
z1. Use the functionzerosto create the vector. - Creates a \(12 \times 1\) vector of all zeros named
z2. Use the functionzerosto create the vector. - Creates a \(1 \times 10\) vector of all ones named
o1. Use the functiononesto create the vector. - Creates a \(6 \times 1\) vector of all ones named
o2. Use the functiononesto create the vector.