ENGR 1181 MATLAB 10: While Loops 1 MAT 10D While Loops 1 Assignment
Total Page:16
File Type:pdf, Size:1020Kb
ENGR 1181 | MATLAB 10: While Loops 1 MAT_10D_While_Loops_1_Assignment
Background The purpose of this assignment is to gain experience debugging a Matlab script file as well as see the value in while loops and real time programming.
Part 1 Debugging is the process of locating and fixing “bugs” or errors in computer program code. 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 labeled MAT_10D_1_Assignment (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 pdf on website labeled MAT_10D_1_Assignment_Output).
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_10_D_1 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 file called MAT_10D_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.