Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I am trying to use the shooting method to determine the angle of a projectile. However for some values of distance and initial velocity my value for angles get stuck between two values.

I want to put a piece of code into my shooting method which can either detect that my while loop has become stuck between two values or after a certain number of values offers an error message suggesting a different initial velocity for that distance.

I was thinking of using a try catch statement however i am not sure how these work and i am not sure how to state i want my error message to occur after a certain value of iterations of my while loop.

If you want my present code i can post it.

Any help would be great.

Thanks

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# A simple problem with matlab code

Loading...

Similar Threads - simple problem matlab | Date |
---|---|

Some simple problem with my GUI? | Nov 8, 2017 |

Simple C programming problem, variable stuck at initialised value | Dec 16, 2013 |

Simple Calculator Problem (C++) | Aug 19, 2012 |

Fortran Simple Harmonic Oscillator Problem | Dec 8, 2011 |

Java problem - prob simple! | Nov 6, 2011 |

**Physics Forums - The Fusion of Science and Community**