An engineer has collected a series of N data points representing the elapsed tim
ID: 3847858 • Letter: A
Question
An engineer has collected a series of N data points representing the elapsed time since an experiment began (at time 0) to the occurrences of a particular state. He is concerned that there has been a problem with the equipment used to automatically record the measurements and that some recordings were mistakenly recorded multiple times into the data set (consecutively occurring of course). Write a MATLAB FUNCTION which accept this data set as an input array and then returns the following three things (in order) If there was duplication (return logical true if yes and logical false if no) The the number of unique times consecutive duplication occurred The corrected data set with duplication removed, *proper variable names must be used as with course guidelines For full marks, you must also process the following example by hand with your algorithm (showing details)!!! [1 4 5 5 5 9 11 11 13 15 15 16 output: true, 3, [1 4 5 9 11 13 15 16]Explanation / Answer
Matlab code:
function [bool,occur,modify] = duplicates(original)
occur = 0;
modify = unique(original);
if(size(original,2) == size(modify,2))
bool = false;
else
bool = true;
end
for i = 2:size(original,2)
if(original(i-1) == original(i) & original(i-1) != original(i-2))
occur = occur + 1;
end
end
end
Sample Output: