# Finding the initial conditions which give a specified event using ode45

조회 수: 4 (최근 30일)
Patrick Shortall 2021년 1월 11일
답변: Mischa Kim 2021년 1월 11일
I'm using ode45 to solve a system of ODEs which describe the movement of a projectile. I now want to find the initial angle which will result in the projectile crossing the x-axis at a specified point x. Is this possible? I was thinking of some sort of iteration method which tests out different angles until it finds one that works, but I need the angle to 8 significant figures, so I feel as if this would result in a lot of iterations.

댓글을 달려면 로그인하십시오.

### 답변 (1개)

Mischa Kim 2021년 1월 11일
Patrick,
as Walter pointed out this is a BVP. However, you can and I personally would use ode45 and the so-called shooting method to solve this problem. I recommend taking a step-by-step approach:
1. First solve the differential equation of the projectile without worrying about x-axis crossing or how to manipulate the initial angle.
2. Next use an events function to identify the x-axis crossing. Here is an example that may be helpful.
3. Once you get this to work implement the shooting method. These are a few more lines of code, and this is where you (MATLAB) would do the iterations you are referring to in your question.
Feel free to share your code if you have more questions.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by