Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB ONLY*** My code so far clear clc xcoords = [0 1 2 3 2 3 2 1 0]; ycoords= [2 1 1 2 2.5
MATLAB ONLY***
My code so far
clear clc xcoords = [0 1 2 3 2 3 2 1 0]; ycoords= [2 1 1 2 2.5 3 4 4 3]; a=size(xcoords); b=size(ycoords), zcoords= ones(1,9); pacman=[xcoords;ycoords;zcoords]; fill(pacman,'yellow')
Questions 1-2: Create an image of the Pacman character. Start by entering the coordinates for the Pacman image shown below. You will not draw the points. These are just to help you create the vectors for the Pacmarn figure i. To enter the points for your Pacman figure, start with the green point, and proceed counterclockwise through the yellow points and stop at the red point. First, create a vector for the x-coordinates of each point. >xcoords Enter the x values here. ] Create this Pacman image! 4 ii. Now enter the y-coordinates for each point in the exact same order 2 >ycoords Enter the y values here. ] Note the y-value for the mouth is a half-integer iii. Later, we will need to use homogeneous to help translate the Pacman figure about a maze. Add the z-coordinates, all of which are 1. The number of 1's must be the same as the number of x's and y 's. Finish the assignment statement below. Use both the size and the ones command >zcoords... rdinate o -1 1 01 2 3 45 iv. Be sure to define: pacmanDxcoords; ycoords; zcoords]; You will need this variable to move the Pacman around the maze later Now paste in an image of your Pacman character. Use the fiLlOcommand to create your plot. Set the of red). Do not draw the points! Label both axes and add a title to the plot. LineWidth' to 4. You will not need the z-coordinates at this stage. Draw your Pacman using yellow (insteadStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started