ee150_ballSkeleton

ee150_ballSkeleton - %ee150_bball.m function

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
%ee150_bball.m function ee150_ballSkeleton(target_height) %---------------------------------- % Constants %---------------------------------- radius = 0.7; % radius of the ball x0 = 0; % position of the center of the ball y0 = 10 + radius; w = 3*pi; % angular velocity (radians/sec.) g = 9.81; % gravitational acceleration constant in m/s^2 g %---------------------------------- % Duration of the movie, frames per second, and other values %---------------------------------- duration = 15; framerate = 30; maxframes = duration * framerate + 1; dt = 1/framerate; % delta time between each frame targetx=19.5; targettop=target_height+2.5; targetbot=target_height-2.5; else target_height=rand*15+2.5; targettop=target_height+2.5; targetbot=target_height-2.5; end e %---------------------------------- % Draw the initial ball, ground, and target %---------------------------------- % to draw the ball we'll have 512 points around the circumference n = 512; n % Creates a vector of 512 angles from [0 2*PI] radians to be used % to calculate the points on the circumference of the ball % rotate/spin the ball arg = [0 : 2*pi/n : 2*pi]; a % Initial ball circumference X,Y coordinates matrix % We will never change this representation of the ball and just % rotate it for each frame % 8 Rows (1 for each sector) x 512/8 + 1 cols % Extra col => starting point of each sector is 0,0 xi = zeros(8,1+n/8); yi = zeros(8,1+n/8); y %=== For LAB completion====
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

ee150_ballSkeleton - %ee150_bball.m function

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online