Lecture33_Serial_Comm_III - Peak Detection

Demonstrate your work during the class to get the credit. If you can't get it done, you still have a chance to work it in the next class or you can checkout a board to work on it afterwards. 

Task 1: (20 points)
Use the serial signal communication techniques you learned in the past lectures, to collect a voltage series that have sharp peak like the figure below:



Task 2:
(40 points)

Save your data on your hard drive. Load the data and use 'findpeaks()' function to find out the peaks and the locations of the data.


The prominence of a peak measures how much the peak stands out due to its intrinsic height and its location relative to other peaks. A low isolated peak can be more prominent than one that is higher but is an otherwise unremarkable member of a tall range.
Minimum peak prominence, specified as the comma-separated pair consisting of 'MinPeakProminence' and a real scalar. Use this argument to have findpeaks return only those peaks that have a relative importance of at least 'MinPeakProminence'.

Use the peak detection method to mark all the peaks in your signal. Make sure you customize the following features in your plot and make it looks presentable: labels, titles, proper font size for the labels, marker size, line width, and the plot frame line width (set gca).

**Hints:
Use the following script to collect your data:


Try the two versions of the peak-finder below, adjust the 'MinPeakProminence' and the 'movmean' functions until you are happy with your peak detector.


An example of the results:


Note that you must have correct X and Y axis labels in your figures in your report.

Task 3:
(40 points) (No Arduino board is needed for this)
Complete the following code to label the peaks that are higher than 1.2 in the figure. (the data is in the Matlab library, so feel free to just load it).


Example plotting:


Modify the figure title/frame/line width/font size/marker size/lables to make it looks more presentable.