Any help would be great, i have tried everything i Just need to know how to do t now its driving me insane!!
a) The position of a projectile fired at a height h from the ground and at an angle
will be given at time t by,
𝑥(𝑡) = 𝑣0 cos() 𝑡
𝑦(𝑡) = ℎ + 𝑣0 sin() 𝑡 −
Write a script to calculate the x and y positions for different times and plot the
trajectories. You don’t want to plot for negative values of y (i.e. after the projectile
has landed), so make sure the vectors for x and y only contain the required data.
(HINT: think loops!) Find the position of the last element, where y=0 (or is close
to it), and use this to determine the range of the projectile. Show some plots for
h=0, for a couple of different values of .
b) Find the range of the projectile for a couple of different values of . What are the
limitations to the accuracy of your result? How could the accuracy be improved?
Repeat part (b) for a couple of different values of h and see how the best launch
angle changes as the launch height changes. Can you spot a trend for the optimal
angle as you launch from greater heights?
c) (HARD!) The equations above neglect friction due to the projectile’s interaction
with the air. An equation for friction can be given by,
𝑓𝑑 = 𝑐𝑣
where fd is the friction force, v is the velocity and c is a constant which accounts
for the area and mass of the projectile and the drag coefficient of the air.
Include the drag force in your script. The force will need to be calculated in small
steps and then added to the acceleration. The force will be in the direction of
projectile travel, so at each step you will need to convert vx and vy into vr. (A
function has been provided for this.)
You can use an equation like,
to calculate the change in velocity, vr during a small time step δt.
Investigate which values of c give realistic looking trajectories.
Heres what i have so far:
>> %constant values
g=9.81; %acceleration due to gravity
>> %initial variable values
y=h %vertial value
x=0 %horizontal value
k=1 %number of term of function
>> while y>=0
time=time+0.01; %increases time value by 0.01 for each repetition
x(k)=v*cosd(A)*time; %calculates x values and saves them as an array
y(k)=h+v*sind(A)*time-0.5*g*time^2; %calculates y values and saves them as an array
k=k+1; %increases k value by 1 each repetition
x Turn on thread page Beta
You are Here: Home > Forums >< University and university courses >< Science, Technology, Engineering and Maths university courses >< Engineering
Matlab Help!! watch
- Thread Starter
- 03-03-2016 23:41