Results 1 to 17 of 17

Thread: Physics problem... Maths related..

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Physics problem... Maths related..

    Hello everybody....

    I have a question i have been trying to solve for the past 6 or 7 hours but had no luck....

    lets assume we have a cannon.... that will fire a projectile with initial velocity (V0) at an angle of (θ) with the horizontal axis X.

    the motion equations of the projectile in X and Y directions are in this image:



    and the gravity (g) is given as 9.81 m/s^2

    key: ^2 = to the power 2 or squared

    The user will insert the values of initial velocity (V0) and Target Distination (XT) that the projectile should hit. It is assumed that the target location will have a Y value of 0 m (on the ground).

    and i will have these tasks to do:

    1- Solve for the projectile angle θ using equation (1) given above in order for the projectile
    to hit XT.

    2- Generate the list of projectile’s movement in X and Y directions using the (V0) and θ from steps 1 and 2 with a time interval of 0.005 second and plot the results. The target should be plotted using a cross sign ‘x’.

    i dont know how to solve this question, i have tried but the last thing i could think off is re arrange the 2 equations and make θ the subject of the equations and then equate them. i am still confused in how to solve this...

    i will be using Matlab 7.5.0 for this and i am not really familiar with the coding in there either... so please try to help me in the form of matlab codes...


    thank you
    Last edited by K-PRO; May 21st, 2008 at 10:03 AM.
    Kalogerus Productions (K-Pro)

  2. #2
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Physics problem... Maths related..

    Why don't you think about which parameters you know?

    You know x = XT
    You know y = 0
    You know V0 = given
    You know g = constant

    You are left with two equations and two unknowns, theta and t. Given that you solve these by eliminating one of the two (by rearranging eq 1 for a certain parameter and substituting into eq 2), and you want to find out theta, which do you think you might try to eliminate?

    Follow the same thought process for part 2, except this time you know different parameters...
    I use VB 6, VB.Net 2003 and Office 2010



    Code:
    Excel Graphing | Excel Timer | Excel Tips and Tricks | Add controls in Office | Data tables in Excel | Gaussian random number distribution (VB6/VBA,VB.Net) | Coordinates, Vectors and 3D volumes

  3. #3
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Physics problem... Maths related..

    If you can/must use Matlab for everything (not just graphing) you can have Matlab easily solve the two equations with two unknowns (mentioned above by zaza) automatically. Don't ask me exactly how, I don't know Matlab that well, but I'm sure google or Matlab's help function will tell you all you need to know.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    ok i wud but why is y = 0 ?
    at the start and end it would be 0 yes when t = 0 as well .... but how do i find the heighest point
    and eventually solve to get the equation of the curve...

    i have tried to solve with these values taking V0 = 10 and XT = 7
    and solving the 1st equation would be like this when substituting the values
    7 = 10 * cos θ * 0
    which is gonna give me when solving for θ
    7/0 = cos θ
    and which is goin to give me 90 for θ
    and thats a constant answer which is impossible to be because a cannon is not firing upwards....


    thank you for ur quick response
    Last edited by K-PRO; May 21st, 2008 at 12:21 PM.
    Kalogerus Productions (K-Pro)

  5. #5
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Physics problem... Maths related..

    The value of y = 0 is because the target (XT) is on the ground, at a height of y = 0.

    I can't see any question regarding the maximum height, maybe I'm interpreting the questions wrong, or maybe you are..?

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    maybe.... i understand this part... but if u try to substitute the values in the 1st equation
    XT = choose any value
    t = 0
    y = 0
    V0 = choose any value
    g = 9.81
    θ = ? we will have to find that

    when u try using any values the value of θ will always be 90 as u will end up having cos θ = 0
    so θ = inverse cos (0)
    which will always give u 90

    as for if u want to substitute the values when the projectile hit the ground in the end
    u will have these values

    V0 = defined by user
    XT = defined by user
    g = 9.81
    t = ?
    θ = ?

    maybe we shud use some of the basic mechanics formulas to find time
    or i remember during high school doing sum differenciation and integration to find distance because in our questions we used to have an unknown t value as well as the distance or acceleration....

    but thank you for ur reply
    Kalogerus Productions (K-Pro)

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    I have tried to add one more variable which is the final velocity when the projectile hits the ground last....

    that would be 0

    and applied this formula from basic mechanics
    S = 1/2*(u + v)*t
    S is distance = 7
    u is initial velocity = 10
    v is final velocity = 0
    and time we need to find
    and got 1.4 seconds

    maybe that would help... maybe not but i will keep on trying
    Kalogerus Productions (K-Pro)

  8. #8
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Physics problem... Maths related..

    I'm still not sure we're on the same wavelength here...

    Why are you choosing t = 0? Surely the projectile won't hit the target at the same time that it is fired? t should be a variable you have to solve for.
    Also, why do you get cosθ = 0 for t = 0, the t is not inside the cos!

    My understanding of the question is that you have to choose some target distance xt, and need to work out the angle θ needed to reach that distance (in terms of the distance and the other parameters).

    I have tried doing this myself but I could not do it by hand... I put it into maple and it was quite an ugly expression (with about 4 or 5 solutions apparently).

    What I did was to put x = xt and y = 0:
    1) xt = v cos(θ) t
    2) 0 = v sin(θ) t - 1/2gt2

    Solving 1) for t yields:
    t = xt / [ v cos(θ) ]

    Plugging this into 2) yields:
    v tan(θ) xt = [ g / (2v2cosθ) ] xt2
    (Note that this also tells you the shape of the path!)

    Solving this for xt yields:
    xt = 2 tanθ cos2θ v2 / g

    So while you now have an equation relating only θ and xt, trying to solve for θ does not work really well...

    But it should if you are supposed to do this... Am I not understanding the question right?


    EDIT
    I tried doing it the other way around aswell, by solving 1) for θ first.
    This yielded 4 values for t, and plugging one of them (at random) back into the equation for θ yielded:
    θ = arccos((1/2)*x*sqrt(2)*g/(v*sqrt(v^2+sqrt(-g^2*x^2+v^4))))

    (yeah...)
    Last edited by NickThissen; May 21st, 2008 at 02:23 PM.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    lol this is too much to really read and understand for me
    when i said i will get cos θ = 0
    thats because the starting time will be a 0
    so if u try to solve the 1st equation
    X = V0 * Cos θ * t
    X = 7 which would be the distance covered
    V0 = 10 the initial velocity
    the starting time t = 0
    so if u solve it u will get cos θ = 0

    i tried to apply the formula as i mentioned and got t = 1.4
    which t will be the total time... which will be at the end
    and the final velocity V = 0 because the projectile doesnt hit anything but naturally comes at rest...

    i hope i made sense...

    Edit: and when you substitute the values in formula (2) u will get the heighest point the projectile will reach thats 181.793
    this will make a straight line graph....

    now i think to find the curve i need to have a formula of the line and integrate it to find the curve formula
    and apply it... correct me if m wrong

    thanks
    Last edited by K-PRO; May 21st, 2008 at 03:09 PM.
    Kalogerus Productions (K-Pro)

  10. #10
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Physics problem... Maths related..

    I don't understand why you are looking at t = 0. Obviously at t = 0, x and y will also be 0, and there is no angle θ to consider yet...

    Basically you have two equations with two unknown variables (and a bunch of known parameters). This can generally be solved, but in this case it's quite hard to solve by hand.

    Instead, you can use Matlab (right?). Still, if you don't have any values for the parameters (XT and V0) you can't really make much sense out of the answers, at least not after inspecting them for some time...


    But now you mention you have values for XT and V0? Specifically:
    XT = 7m and V0 = 10 m/s?

    If this is so, the first question can be easily solved using Matlab.

    I solved it using Maple (similar to matlab) and I got 4 different solutions.
    Two of the solutions gave me a negative time and are thus physically nonsense.
    The other two gave a plausible answer.

    But because I'm not sure if this is homework or not I'm not simply going to hand you the answers, I'm going to try to help you how to solve it using Matlab.


    Basically, you have what is called a system of equations. You have two equations and two unknown variables.
    You might recall that if you have one equation with two unknown variables, it is impossible to find a single solution.
    Now however you have two (seperate, independend) equations for the same two variables -> you can solve this.

    Try looking up the "solve" function of Matlab (using google or matlab's help function). In Maple, I can use the solve function to solve a system of equations like this, it might be similar in matlab:

    In general:
    Code:
    solve( [ equation 1, equation 2 ], [variable 1, variable 2] )
    Example:
    Code:
    solve([x+y = 2, -2*x+3*y = 3], [x, y])
    This solves equation1: x+y = 2, and equation2: -2x+3y=3, for x and y.
    The answer: x = 3/5, y = 7/5.


    Can you figure out which equations you should use in this solve function instead of "x+y=2" and "-2x+3y = 3" ?


    EDIT
    After reading your posts again I think you don't fully understand how you would be able to solve such a question.

    Let me try to explain...

    A projectile motion (like this) consists of two motions combined. Firstly, the motion in the (vertical) y-direction, which is affected by the initial velocity in the y-direction and the force of gravity. Secondly, the motion in the (horizontal) x-direction, which, without friction, is only affected by the initial velocity in the x-direction.

    If a projectile is fired at an angle θ with the x-axis, the initial velocity has two components: one in the x-direction and one in the y-direction.
    You could call them v0,x and v0,y.
    When you draw a diagram with an arrow (vector) representing the velocity you can see quite easily that:
    v0,x = v0 cosθ
    v0,y = v0 sinθ

    Applying the motion equations we can relate these velocities to positions:
    x = x0 + v0,x*t + 1/2*ax*t2
    y = y0 + v0,y*t + 1/2*ayt2

    But, x0 = y0 = 0 (fired from origin).
    Also, ax = 0 since there is no acceleration in the x-direction (no force pushing the projectile in the x-direction).
    Finally, ay = -g since the acceleration in the y-direction is just the acceleration caused by gravity.

    Thus we get:
    x = v0cos(θ) t
    y = v0sin(θ) t - 1/2gt2


    Now, these two equations describe the position (x,y) of the projectile as a function of time and the angle θ.
    If you are given the final position of the projectile (x = XT and y = 0) and the initial velocity (V0), you can solve the two equations for t and θ. This gives you one (or more) angles θ and times t for which the projectile lands at x = XT and y = 0.

    This is what you need to do!
    Plug in the values x = XT and V0 and y = 0 and you have your two equations with two unknowns.
    Last edited by NickThissen; May 21st, 2008 at 03:41 PM.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    Quote Originally Posted by NickThissen
    I don't understand why you are looking at t = 0. Obviously at t = 0, x and y will also be 0, and there is no angle θ to consider yet....
    I agree with u in this...

    Quote Originally Posted by NickThissen
    Basically you have two equations with two unknown variables (and a bunch of known parameters). This can generally be solved, but in this case it's quite hard to solve by hand.
    I also agree with u in this

    Quote Originally Posted by NickThissen
    Instead, you can use Matlab (right?). Still, if you don't have any values for the parameters (XT and V0) you can't really make much sense out of the answers, at least not after inspecting them for some time...


    But now you mention you have values for XT and V0? Specifically:
    XT = 7m and V0 = 10 m/s?
    I also agree with u so far

    Quote Originally Posted by NickThissen
    If this is so, the first question can be easily solved using Matlab.

    I solved it using Maple (similar to matlab) and I got 4 different solutions.
    Two of the solutions gave me a negative time and are thus physically nonsense.
    The other two gave a plausible answer.
    i get an error, i have looked the solve function and used it accordingly but it gave me an error
    Code:
    ??? Undefined function or variable 'a'.
    
    Error in ==> physics at 8
    solve ((U * cos(a) * t),(U * sin(a) * (t^2) * (t-(g/2))),a,t);
    Quote Originally Posted by NickThissen
    EDIT
    After reading your posts again I think you don't fully understand how you would be able to solve such a question.
    I really dont, this isnt my thing, but i am helping my brother putting this in matlab and he is not home right now... i just tried learning something new...

    i will read the explaination and try then reply
    Kalogerus Productions (K-Pro)

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    OK i partially understood the situation and i will work on it right now...
    i am sorry if i wud seem stupid but what happened to the original formula's i dont see them in your explaination....

    lol physics isnt really my thing i am just a programmer....
    in the mean while i will work on what you explained and what i have understood....

    thank you
    Kalogerus Productions (K-Pro)

  13. #13
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Physics problem... Maths related..

    The equations you are using in the matlab solve code are not correct!

    Look at them carefully again, they are not even equations! (And the second is wrong anyway...)

    I would try:

    solve( (U * cos(a) * t = XT), (U * sin(a) * t - 1/2*g*t^2 = 0), a, t)

    Where U = 10, XT = 7 and g = 9.81.

    Maybe the syntax is not completely right but I can't help you with that since I never used matlab....

    EDIT
    For the syntax maybe try this site:
    http://webche.ent.ohiou.edu//matlab/n_lin_al.html

    Look at the 'System of Non-Lineair equations' in particular (since this is what you are dealing with).

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    yes but i have defined U and G and X earlier....
    Kalogerus Productions (K-Pro)

  15. #15
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: Physics problem... Maths related..

    From what (relatively little) I know of Matlab, it doesn't solve functions in the way you're using, since it has no knowledge of symbolic manipulation--all it can do is evaluate functions. In fact the function you've errored on looks remarkably like something you'd feed Mathematica instead. The non-linear systems example linked uses a function fsolve which makes better sense to me for Matlab. Sorry I can't be of more help.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  16. #16
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Physics problem... Maths related..

    I don't know anything about Matlab either. Maybe you can try downloading a trial version of Maple if it exists?

    Even so, the function you are feeding into Matlab is not an equation...!

    If you did exactly what you posted, you fed the following 'equation' into the solve function as one equtaion to solve for:
    (U * cos(a) * t)

    This is NOT an equation! It doesn't equal anything...!

    What it should be is:
    (U * cos(a) * t) = XT


    If this isn't homework or anything I can post the answer, but I'm 100% sure Matlab can solve this system of non-linear equations...

    Just look on google or the matlab help on to solve a system of non-linear equations.

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    121

    Re: Physics problem... Maths related..

    ok i have asked a friend of mines and my physics teacher that taught me back in high school

    P.S my brother submitted the project but m doin this coz its interesting

    my brother somehow did this calculation

    Code:
    s= (2*g*Xt)/(Vo^2);
    m =asin(s)/2;
    angle= (m);
    
    theta = real(angle);
    
    fprintf ('\nThe intial projectile angle is %g radians',theta);
    t = ((2*Vo*sin(theta))/g);
    
    Xmax= Vo*cos(theta)*t;
    Key:
    asin = sin inverse
    real(angle) = the real part of the angle ignoring the imaginary part

    now my friend did these calculations and based on that i have made my project which i will include the codes for it:




    Code:
    a = (asin((X * g)/(VO^2))) / 2;
    t = (2 * VO * sin(a)) / g;
    but the value of a which is thita is not the same value as my brother's project, however, when i asked the teacher and we were solving together he said something about the maximum value of X and he found thita as my brother did it, on the calculator though... unfortunately he was in a hurry so he was not able to explain it but he said something about the range and the value of X.

    and said my brother's project is perfectly correct in values.

    please explain this part to me... where m i going wrong and what should i do...

    my brother didnt really bother to write any explainations he just solved it on paper and put it in the program... the teacher said my program is correct but i need to replace something with something else... and said something about the range too

    thank you
    Last edited by K-PRO; May 24th, 2008 at 07:19 PM.
    Kalogerus Productions (K-Pro)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width