hw2_finished - % Boolean turned on for making a movie:...

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

View Full Document Right Arrow Icon
% Boolean turned on for making a movie: Make_Movie=1; % Geometry of the closed container: Right_Wall = 1; Left_Wall = 0; Bottom_Wall = 0; Top_Wall = 1; IS_WALL_RIGHT = 1; IS_WALL_LEFT = 1; IS_WALL_BOTTOM = 1; IS_WALL_TOP = 1; % Physical parameters: g =.0981; alpha=.8 ; beta =.99 ; % Acceleration: acceleration_x= 0; acceleration_y= -g; % Parameters for time evolution: final_time=100; dt =.03; % Initial time: t=0; % Initial velocity vector: v_hor= .3; v_ver= 0; % Original position of the ball: Radius=.05 ; x=.5 ; y= 1-Radius; count=0; if Make_Movie fig=figure; aviobj = avifile( 'Bouncing_Balll.avi' ); end while t<final_time && count < 2000 if t+dt>final_time dt=final_time-t; end t=t+dt; v_hor = RK2(dt, v_hor, acceleration_x);
Background image of page 1

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

View Full DocumentRight Arrow Icon
v_ver = RK2(dt, v_ver, acceleration_y); % Treatment at the bottom wall: if ( RK2(dt, y, v_ver ) ) < Bottom_Wall + Radius && IS_WALL_BOTTOM % would cross the wall. % Position the object on the wall and Draw: x = RK2( dt, x, v_hor ); y = Bottom_Wall + Radius; Draw_Disk(x,y,Radius); axis([0 1, 0 1]); pause(dt/10);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/19/2012 for the course ENGR 361 taught by Professor Drexel during the Spring '12 term at Bloomsburg.

Page1 / 4

hw2_finished - % Boolean turned on for making a movie:...

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

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