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.
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
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.
2: (30 points)
Modify the code, store all the detected data in a new
3) Task 3: (40 points)
Plot the data in
professional way. Save your data as 'y_lec33.mat' in your harddrive.
Then load the data, convert the X and Y axis to time and voltage.
Follow the same standard from the last lecture to plot the data in a