Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Matlab only, complete A save script file as LastName_Project_01_timer.m save function file as LastName_timer.m PROJECT W2N You are required to write 2 codes to

Using Matlab only, complete A

save script file as LastName_Project_01_timer.m

save function file as LastName_timer.m

image text in transcribed

image text in transcribed

PROJECT W2N You are required to write 2 codes to control the traffic light for the above intersection A) Draw a flow chart AND write a code to control the traffic lights at the intersection shown. The (Adding a yellow light is for extra credit!) Consider the 8 lanes: South to North (S2N), South to West (S2W), North to South (N2S), North to East (N2E), East to West (E2W), East to South (E2S), West to East (W2E), and West to North (W2N) with the following pairs and sequence:(1) S2N & N2S turns green together for 5 seconds, (2) S2W & N2E together, (3) E2W & WZE together, (4) E2S & W2N together. The code should display a countdown timer from 5 to 1 seconds, for each green light, and run continuously for one full cycle (each pair of lanes get the green light once) than ask the user to repeat or quit. For the time-based case, the output for the 1 should look like the following: rec S2N N2S Green Green Red Red Red Red Red Red W2E N2E E2S W2N Counter: 5-4-3-2 display countdown timer) The above list and counter should update and display every time the light changes For the sensor-based case, the output should look like the following: S2N N2S E2W W2E Green Green Red N2E E2S W2N Red Red Counter: 5-4-3-2-1 (display countdown timer) New Sensor readings: S2N N2S E2WW2E S2W N2E E2S W2N The above list and counter should update and display every time the light changes. The sensor data should be re-generated and read at the 4t second of each cycle and should have values for all lanes. To get the full credit, you should draw the required flow charts to represent your algorithms and your code should be functioning for both time-based and sensor-based cases. You are highly encouraged to work in groups but at the end you will need to produce your unique final code that represent your own work. There are several ways of coding any problem and any code that will be proven to be partially or fully copied from others will get 0 credit. Hint: You can use pause(n) to pause for n seconds and place it inside a loop for the countdown timer Use 1 script file and at least, 1 function file for each code, For example, use a function file to run the timer, to generate and display a countdown timer, or choose any task to perform it in a sub-function and call it from the main script. You can use any numbers of script and function files to perform the given task. Addition of unique and extra representation method for traffic lights and the results, such as using Graphical User Interface (GUI), plot, line commands, can get up to 30% extra credit of the project credit PROJECT W2N You are required to write 2 codes to control the traffic light for the above intersection A) Draw a flow chart AND write a code to control the traffic lights at the intersection shown. The (Adding a yellow light is for extra credit!) Consider the 8 lanes: South to North (S2N), South to West (S2W), North to South (N2S), North to East (N2E), East to West (E2W), East to South (E2S), West to East (W2E), and West to North (W2N) with the following pairs and sequence:(1) S2N & N2S turns green together for 5 seconds, (2) S2W & N2E together, (3) E2W & WZE together, (4) E2S & W2N together. The code should display a countdown timer from 5 to 1 seconds, for each green light, and run continuously for one full cycle (each pair of lanes get the green light once) than ask the user to repeat or quit. For the time-based case, the output for the 1 should look like the following: rec S2N N2S Green Green Red Red Red Red Red Red W2E N2E E2S W2N Counter: 5-4-3-2 display countdown timer) The above list and counter should update and display every time the light changes For the sensor-based case, the output should look like the following: S2N N2S E2W W2E Green Green Red N2E E2S W2N Red Red Counter: 5-4-3-2-1 (display countdown timer) New Sensor readings: S2N N2S E2WW2E S2W N2E E2S W2N The above list and counter should update and display every time the light changes. The sensor data should be re-generated and read at the 4t second of each cycle and should have values for all lanes. To get the full credit, you should draw the required flow charts to represent your algorithms and your code should be functioning for both time-based and sensor-based cases. You are highly encouraged to work in groups but at the end you will need to produce your unique final code that represent your own work. There are several ways of coding any problem and any code that will be proven to be partially or fully copied from others will get 0 credit. Hint: You can use pause(n) to pause for n seconds and place it inside a loop for the countdown timer Use 1 script file and at least, 1 function file for each code, For example, use a function file to run the timer, to generate and display a countdown timer, or choose any task to perform it in a sub-function and call it from the main script. You can use any numbers of script and function files to perform the given task. Addition of unique and extra representation method for traffic lights and the results, such as using Graphical User Interface (GUI), plot, line commands, can get up to 30% extra credit of the project credit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

Prepare each of the ratios and compare them to the benchmark.

Answered: 1 week ago