question archive Midterm Exam INSTRUCTIONS Complete the exercises below and upload them to Canvas as a single MATLAB script file (
Subject:Computer SciencePrice: Bought3
Midterm Exam
1. Separate each question into separate, runnable sections using the “%%” comment notation.
2. You may use the code and notes from class, the textbook, and MATLAB’s documentation.
There are 3 questions for this exam.
( ENGR 131 21F-IN-060-101-A (Midterm Instructions) ) ( 9/23/2021 ) ( Page 1 of 5 )
1. SOLVING SYSTEMS OF EQUATIONS (20 PTS)
Apple Football Grapes Leaves Pumpkin Tree
Cup Profile With Markings for 5, 9, and 16 oz.
( Cup 3 oz 8 oz 14.5 oz )0 0.5 1
· Any live cells with fewer than two live neighbors die, as if by underpopulation.
· Any live cell with two or three live neighbors lives on to the next generation.
· Any live cell with more than three live neighbors dies, as if by overpopulation.
· Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
( 18 16 14 12 10 8 6 4 2 (b) 2 4 6 8 10 12 14 16 18 20 )20
Use Matlab to program this simulator by doing the following:
b. When the user presses ‘q’, exit the simulation.
c. For all other entries, remind the user to enter only the two approved entries.
d. The simulation should continue until the user exits.
C) Use the following functions to keep your code modular:
a. A function to implement the rules above to determine the fate of each cell.
b. A function to plot the cells and whether they are
· Don’t worry about the edges (first and last rows and columns).
· For more interesting behavior, check out the file StartingCells2.mat and StartingCells131.
|
|
|