Cameron Devine

Computer Application in Engineering

Course description

This course introduces students to coding structures in MATLAB with specific emphasis on Logical Functions, Selection Structures, and Repetition Structures. If time allows, plotting may also be covered.

General information

Instructor
Cameron Devine Ph.D.
Email
[email protected]
WeChat ID
ProfDevine
Times
MWF 8:00 - 8:40 am (Voov)
TTr 4:00 - 4:40 pm (Recorded)
Lecture Notes
Notes

Texts

Schedule

The following schedule is tentative. Voov lectures are shown in bold.

day topic reading assignment
5/15 Introduction    
5/16 Relational Operators 8.1  
5/17 Flowcharts and If Conditions 8.2, 8.4  
5/18 Logical Functions 8.3  
5/19 If Conditions 8.4 Ass. 1
5/22 Switch Case 8.4  
5/23 Debugging 9.1  
5/24 For Loops 9.2  
5/25 While Loops 9.3-9.4  
5/26 Breaking Loops 9.5 Ass. 2
5/29 Nesting 9.5  
5/30 Loop Efficiency 9.6  
5/31 Loop Efficiency 9.6  
6/1 Loop Efficiency 5.1  
6/2 Plotting 5.1 Ass. 3

Assignments

Assignment 1

  • Write a MATLAB script to complete problems 8.1 and 8.4.
  • Use the template provided here for this assignment.
  • Turn in your MATLAB code on moodle.
  • Solution.

Assignment 2

  • Write a MATLAB script to complete problems 9.3, 9.4, and 9.6.
  • Use the template provided here for this assignment.
  • For problem 9.6 calculate the next 10 values and use the starting values provided in the template instead of prompting the user for input (plotting is also not necessary).
  • Turn in your MATLAB code on moodle.
  • Solution.

Assignment 3

  • Write a MATLAB script to complete problems 9.17 and 9.18.
  • For problem 9.17 use for loops to redo problem 8.10 which utilizes table 8.11 (not table 8.9).
  • Turn in your MATLAB code no moodle.
  • No template for this assignment.
  • Solution.

Assignment policies

Weekly homework will be due on Sunday at midnight. You are expected to use MATLAB to complete the problems assigned. Turn in your completed code on moodle.

Working in groups on homework is strongly encouraged, but the code you submit must be your own.

Project

There is a common game played by two people, where one person will choose a number, and the second person tries to figure it out. The person trying to figure out the number by making guesses and the first person tells them if the number is too high or too low. For your project you will write a MATLAB function to figure out the number. A template for this function is provided here. This function has a single input. The first time the function is run, the string "initial" is provided as the argument instruction. The following times the function is run either the string "high" or "low" is provided as the argument to your function if the guess was too high or low respectively.

After you turn in your function, it will be tested to determine how many guesses it takes to correctly guess a set of numbers. The numbers used will all be in the range of 1 to 100 inclusive. The functions you and your classmates turned in will then be ranked based on their performance. However, your grade on the project will only be based on your ability to guess the number correctly, not how many tries it takes.

A MATLAB script is available here to test your function. The template provided above also includes an example of a persistent variable which keeps its value between each time the function is run. This can be incredibly useful in completing the task efficiently.

Remember: only turn in a function you wrote yourself.

Grading policy

See Professor Li’s policy on grading.

Attendance policy

See Professor Li’s policy on attendance.

Desired Course Outcomes

Upon completion of Computer Application in Engineering, the following course outcomes are desired:

  1. Students will have a clear and thorough understanding of how MATLAB is structured.
  2. Students will obtain skills:
    • to successfully manipulate if/else statements, for loops, while loops, and logical expressions in MATLAB
    • to use pseudocode and flowcharts to plan their coding structure
    • Measure the time required to execute program components
  3. Students will create clear MATLAB code by correctly and thoroughly commenting their script files.
  4. Students will be able to successfully apply MATLAB coding skills in a professional engineering environment.