Write a UDF sData that takes in a vector as input and returns another vector as the
output where each element in the output vector is the average of 3 values: itself and
the two neighboring values.
The only exceptions to this rule are the first and last values of the input vector that are
the same as the first and last values of the output vector respectively.
Example test cases:
Input Vector Output Vector
[1, 4, 2] [1, 2.3333, 2]
[1, 5, 3, 6, 2, 8, 3, 9] [1, 3, 4.6667, 3.6667, 5.3333,
4.3333, 6.6667, 9]
b) In the main script,
1. Prompt the user to enter length for the vector.
2. Generate a row vector with values in [1,10] using randi and the length entered by
the user.
3. Print the row vector generated in the previous step.
4. Call the UDF sData using the row vector generated in the previous step (Step 2).
5. Print the row vector returned from UDF sData.