hey all
ive been trying to use the pause function in MTLAB to achieve a cool animation effect for my projectle motion code. it hasnt been working, can anyone help me out?
thanks!
clear , clcg=9.8;ang=input('Enter incident angle: ');if (ang<=0) disp('Illegal Input')endv=input('Enter speed(m/s): ');if (v<=0) disp('Illegal Input')enddisp('enter air resistance below. If you enter 0 or a negative number, it will be automatically .5')disp('To find the coeficient of air resistace multiply air density, drag,area times .5')air=input('Enter air resitiance (Will otherwise be .5): ');if air<=0,' '; air=.5;endvx0=v*cosd(ang)-air*cosd(ang);%Calculation fro air resitance
vy0=v*sind(ang)-air*sind(ang);t=(0:.01:10000);height=vy0*t-.5*g*t.^2;land=find(height>=0);time=(land(end)-1)/100;dist=vx0*time;height2=max(height);fprintf('Distance is %g m \n',dist);fprintf('Max Height is %g m \n',height2);fprintf('Time was %g sec \n ',time);time2=t(land);height3=height(land);vxst=v*cosd(ang);vyst=v*sind(ang);heightst=vyst*t-.5*g*t.^2;landst=find(heightst>=0);timest=(landst(end)-1)/100;distst=vxst*timest;height2st=max(heightst);time2st=t(landst);height3st=heightst(landst);plot(time2,height3)hold onplot(time2st,height3st)xlabel('Time (Seconds)')ylabel('Height (Meters)')
Best Answer