Pre-class Assignment
No participation activities; work on lab 2!
Announcements
- SAGE is hosting another Study Break this Wednesday 2/15, 5 - 6 PM at the Singer Engineering Lounge!
- 3D printing in Rhino with Prof. Gent from the art department
- Lab 2 due Tuesday Feb 21. 11:10am
- Keep me updated if you are stuck!
- Lab hours tomorrow Weds Feb 15 at 1:15pm in Singer 246/240
Learning Objectives and Outcomes
In this lecture you will:
- listen and participate in a short discussion about the results of the check in survey
- listen to a lecture about peak detection, how to implement it in MATLAB, and some syntax differences between MATLAB and C++
By the end of this lecture you should be able to:
- complete exercises 4–5 on the lab (6 is extra credit)
Lecture Content
ENGR 029 SP23 Check-In Survey Results
Baeldung Peak Detection
See example MATLAB code in Lab 2 Github; if you don’t have access, let me know and I will set you up.
Major differences between MATLAB and C++
- Arrays:
- index using
()
instead of []
- first index is 1 instead of 0
- Example:
- to get the first element of an array
myPeaks
:
- MATLAB:
myPeaks(1)
- C++:
myPeaks[0]
- For loops
- To make a for loop, MATLAB has a shorthand when you know you are increasing by 1 each time.
- Example, iterate over all elements of a four element array.
- MATLAB:
for j = 1:4
- C++:
for (int j = 0; j < 4; j++)