Python problem vox = v0 * math.cos(theta * math.pi/180) voy = v0 * math.sin(thet
ID: 3307602 • Letter: P
Question
Python problem
vox = v0 * math.cos(theta * math.pi/180)
voy = v0 * math.sin(theta * math.pi/180)
g = 9.8
Explanation / Answer
Here is the 3 question solution:-
clc;
clear all;
close all;
format long;
v0=input('Enter initial velocity in m/s : ');
theta=input('Enter angle in degree : ');
ga=input('Enter the drag coefficient : ');
h=input('Enter the height above which projectile is fired : ');
vox=v0*cos(theta*pi/180);
voy=v0*sin(theta*pi/180);
g=9.8;
syms t
f=-g*t/ga+(voy+g/ga)/ga*(1-exp(-ga*t))-h;
tol=10^(-8);
% % % N-R Method
s(1)=4;
for n=1:100
l1=subs(f,s(n));
l2=subs(diff(f),s(n));
s(n+1)=s(n)-l1/l2;
e=abs(s(n+1)-s(n));
if (e < tol)
break;
end
end
fprintf('Time at which projectile return to ground : %f second ', s(end) );
x=vox/ga*(1-exp(-ga*s(end)));
fprintf('Range of projectile : %f meter ',x);
OUTPUT:
Enter initial velocity in m/s : 80
Enter angle in degree : 30
Enter the drag coefficient : 0.75
Enter the height above which projectile is fired : 5
Time at which projectile return to ground : 4.894477 second
Range of projectile : 90.024645 meter
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.