Question: MATLAB help Write a function repvec that receives a ROW vector and the number of times each element is to be duplicated. The function should
MATLAB help
Write a function repvec that receives a ROW vector and the number of times each element is to be duplicated. The function should then return the resulting ROW vector. If the second input argument is 0(zero) then the function should return an empty vector
Some examples of calling the function:
>> repvec(5:-1:1,2)
ans = 5 5 4 4 3 3 2 2 1 1
>> repvec([0 1 0],3)
ans = 0 0 0 1 1 1 0 0 0
>> repvec(0,3)
ans = 0 0 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
