prog4a_2533_sp11

prog4a_2533_sp11 - f_left=f(theta_left);...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% CSC 2533 % Spring 2011 % Assignment 4a v0=125; g=9.81; for(h=400:200:1600) f=@(theta) 2*g*h/v0*sin(2*theta)-v0/2*sin(4*theta) . .. -cos(2*theta)*sqrt(v0^2*sin(2*theta)^2+8*g*h*cos(theta)^2); stepsize=1*pi/180; for(grid_point=0:stepsize:70*pi/180) theta_left=grid_point; theta_right=grid_point+stepsize;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f_left=f(theta_left); f_right=f(theta_right); if(f_left*f_right<0) guess=(theta_left+theta_right)/2; theta=fzero(f,guess); x=v0*cos(theta)*(v0*sin(theta)/g+sqrt(v0^2*sin(theta)^2/g^2+2*h/g)); fprintf('h=%4d theta=%.5f x=%.5f\n',h,theta*180/pi,x); end end end...
View Full Document

Ask a homework question - tutors are online