Use the serial interface in Matlab introduced in the last lecture. There is one problem in this script: all the data are plotted in the window and stay there within the detection period. This looks not professional. Think about the ECG (Electrocardiography) monitor in hospital, the data are bing plotted and the past data will disappear and being replaced by the new data.

Let's modify the code to make the monitor looks better.

Use 'while(1)' to make an endless loop. '1' means 'true'.

Use the 'for loop' to grab 100 points and then display. after that, use 'clearpoints(h)' to clear the past 100 pionts.

However, there are two problems in this code. Solve the problems mentioned below and complete the tasks.
1) The Y axis range is not fixed. When you turn the knob of the potentiometer, the Y range keeps changing and the monitor display looks bad. Task 1: Modify the code to fix the Y range.

2) All the 100 points are being overwritten for every 'for loop'. If you press ctrl C in the command window, the final data points in 'y' will be only 100 points. Task 2: Modify the code, store all the detected data in a new variable.

3) Task 3: Plot the data in a professional way. Save your data as 'y_lec28.mat' in your harddrive. Then load the data, convert the X and Y axis to time and voltage. Follow the same standard in Lecture 27 to plot the data in a presentable figure.

Submit an electronic version of your report to the email. Again, have figures, captions, title, explanations, and your code as the appendix. Due Monday.