%For each of the following functions, your team will write the contract, a complete %description, and examples that work for testing. You will also write %test functions for every function here. Tests for functions that draw %are difficult to test directly, so you may carefully describe figure test %results so that any observer can see if the tests pass. %Some functions here are trivial, some take 8-10 lines of %code. Regardless of which functions you are assigned, you must %understand the workings of every function so that you do well on the %exam. %Makes the initial board according to the size parameters. Draws each %circle from parameter vector once to get handles. For a fixed %number of cycles, draws and updates every circle structure in the parameter %vector. %calls: makeBoard, drawCircles, drawAndUpdateEveryCircle function [] = project1a(circles,xSize,ySize) %Creates and returns a board structure function board = makeBoard(xmin, xmax, ymin, ymax) %Draws every circle in the vector once, and returns a vector of the %handles. %calls: drawCircle function handles = drawCircles(circleVector) %For each circle, checks to see if circle is touching edge of board. If %it is, alter the x and/or y velocity accordingly. Then draw the circle, %keeping the new handle. Be sure to delete the old handle to the previous %version of this circle. Update the position of the circle according to %its velocity data. %calls: atEdge, reflectCircle, drawCircle, updateCirclePosition, delete (built-in) function [circleVector handleVector] = drawAndUpdateEveryCircle(circles, handles, board) %Changes the velocities of a circle that has hit an edge. Determine which %edge, then modify the circle. function newCircle = reflectCircle( circle, board ) %Changes the position of a circle to reflect its motion after one cycle, %based on its velocities. function newCircle = updateCirclePosition(circle) %Returns true if the edge of a circle is touching an edge of the board; %false otherwise. function isAtEdge = atEdge(circle, board) %Creates and returns a circle structure. function circle = makeCircle(xpos, ypos, radius, xVelocity, yVelocity, color) %Uses the rectangle function to draw a circle on the current figure. %calls: rectangle (built-in) function handle = drawCircle(circle)