ENGR 1181 | MATLAB 13: Real Time ProgrammingMAT_13D_Assignment

Background

The purpose of this assignment is to gain experience debugging a Matlab script file as well as see the value in real time programming.

Part 1

Debugging is the process of locating and fixing “bugs” or errors in computer programcode. To“debug” a program; start with a problem, isolate the source of the problem, and then fix it such that the program functions in the way it was desired.

Define

In Part 1 of this assignment, you are given a Matlab script file labeledMAT_13D_1a (found on the website). This script file operates the traffic light on Woodruff in front of Hitchcock Hall. The traffic light is initialized and displays the initial state to the user (red light is on, yellow and green lights are off). Every second, the sequence of lights change. The green light goes on and the yellow and lights are off; then the yellow light goes on and the green and yellow lights are off; and then the red light goes on and the green and yellow lights are off. Lastly there is a power outage and all lights go off.

Instructions

Implement

There are five bugs in the given m file. Find the bugs and modify the given m file so that it runs properly (see Command Window on website labeled MAT_13D_1b).

Your script file should include comment statements to help organize your script file.

Make sure the Command Window displays your name, the assignment name, and your group number.

Create and complete a table in Word as shown below:

MAT_13_D Program Errors:

Line of Error / Incorrect / Correct

Document

  • Print to a pdf the final version of your script file.
  • Print to a pdf your command window output.
  • Print to a pdf the Word file of your table.
  • Combine pdf files together and submit to Carmen Dropbox.

Part 2

Real-time programming allows the user to receive, process, or return data at the time of usage.

Define

In Part 2 of this assignment, you are given an incomplete Matlab script filecalled MAT_13D_2_Assignment (found on the website). Once completed, this script file may be used in your Train Lab. This script file causes the left and right lights on the approach gate to alternately flash.

Instructions

Implement

Modify the given m file so that it runs properly (see comment statements within the m file). The script file should use fprintf statements to notify the user each time a light changes to on or off.

Your script file should include comment statements to help organize your script file.

Make sure the Command Window displays your name, the assignment name, and your group number.

(Note: Part 1 and Part 2 are separate script files.)

Document

  • Print (hard copy or to a pdf) the final version of your script file.
  • Print (hard copy or to a pdf) your command window output.
  • Print (hard copy or to a pdf) the Word file of your table.

Submit based on your instructor’s guidelines.