Write a function that takes in a row vector. The function should return a row vector of the same size. The value of result vector at a particular index should contain minimum value of input vector elements up to (and including) that index. If the input is not a row vector, throw an error.
You may not use any built in functions other than size, length, error, fprintf, disp, and zeros.
Example function call:
>> pracFunc([10, 5, 20, 3, 0])
ans = [10, 5, 5, 3, 0]
Next, write a script that tests your function. Create 3 test cases (3 function calls) where your function gets called with:
- [11, 2, -1, 5, -3]
- [-11, 2, 1, 5, 3]
- [ 5, 4, 3, 2, 3]
Display appropriate messages saying whether each test is passed (hopefully your function passes each test).