Write a MATLAB code to obtain the following. Keep yourcode commented whenever required. Copy your source code and commandwidow outcomes and screen shots of any plots in yoursolution.
Generate the following vectors and also implement the Table-1operations-map by employing the switchstatement and an appropriate loop.
- Generate a vector ‘DEC1’ asfollow.
DEC1 = | 5Â Â Â Â 1Â Â Â Â 3Â Â Â Â 0Â Â Â Â 2Â Â Â 5Â Â Â Â 0Â Â Â Â 2 |
- Concatenate vector ‘DEC1’ eight timesin order to obtain a bigger row vector‘DEC’
- N = The length of vector‘DEC’
- Generate a vector ‘t’ with‘N’ equally spaced values within therange of 0 to1
- x = round of26sin(2Ï€9t).
- y = ‘x’multiply by 2.
Table-1 |
DEC(ind) | Operation |
0 | Res(ind)= x(ind) multiply by y(ind) |
1 | Res(ind)= x(ind) divided by y(ind) |
2 | Res(ind)= square root of [x(ind).y(ind)] |
3 | Res(ind)= x(ind) subtract from y(ind) |
5 | Res(ind)= x(ind) add to y(ind) |
* In Table-1,ind is presenting the vector index.