Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta
    • Thread Starter

    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
    A=30 %angle
    v=1 %velocity
    h=0 %height
    g=9.81; %acceleration due to gravity

    A =


    v =


    h =


    >> %initial variable values
    time=0; %time
    y=h %vertial value
    x=0 %horizontal value
    k=1 %number of term of function

    y =


    x =


    k =


    >> 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

    ans =

Have you ever experienced racism/sexism at uni?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.