Question: MATLAB QUESTION. PLEASE ANSWER THIS USING MATLAB 2. [10 marks] In this question you must write a MATLAB function that finds duplicated elements in a
MATLAB QUESTION. PLEASE ANSWER THIS USING MATLAB
2. [10 marks] In this question you must write a MATLAB function that finds duplicated elements in a vector. The output of the function must result in a new vector containing only unique instances of the duplicated values For example, the duplicated element vector E of the vector x- [2 3 2 4 5 652 1 1] is E [2 5 1] Note that the duplicated element vector does not need to be sorted in any particular order, however it must contain only one of every duplicated value of the input vector. Write a MATLAB function find_duplicates (x) that computes and returns the duplicated elements vector of the vector x. You must make sure that the vector x contains only numbers and if not return an appropriate error message. NOTE : You may NOT use the MATLAB functions unique or find in your answer. Hints The MATLAB function isnumeric(A) returns 1 if A is a numeric array and 0 otherwise. The MATLAB function ismember (A,B) where A is a number and B is a vector, returns 1 isutaiud in Band O otherwise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
