MATLAB: Using Roots to Find When Aircraft are 30 Miles Apart

  • MATLAB
  • Thread starter chevymechanic
  • Start date
  • Tags
    Matlab Roots
In summary, the "roots" command in MATLAB can be used to find the roots of a polynomial equation. In this conversation, it is used to solve a problem involving the distance between two aircrafts and finding the time when they are within 30 miles of each other. The command is used after setting up the equation and simplifying it, and it provides the same values as the ones found using Wolfram Alpha.
  • #1
chevymechanic
13
0
"roots" command in MATLAB

Hey everyone. I'm a new user to Matlab. I must say, it's an awesome program, but not user-friendly at all. I'm having trouble trying to use the "roots" functon. Here's what part b of my problem states:

"Use the roots function to compute the time when the aircraft are first within 30 miles of each other."

The first part of the problem asks me to obtain an expression for the distance "D" between two aircraft as a function of time, for which I have: D=sqrt((800-320*t)^2+(410-160*t)^2) a.k.a. the distance formula.

Since they are asking for the time when they are first within 30 mi of each other, I have set D=30. This gives me: 30=sqrt((800-320*t)^2+(410-160*t)^2). I then used Wolfram Alpha and came up with 2 values for t: 2.43246 and 2.59254. I'm guessing the latter number would be correct, because the problem is set up like a giant triangle, D being the hypotenuse, which decreases as the planes fly closer together.

Can anyone help me set this up using the "roots" equation? I can clarify more if needed. Thanks in advance,
Josh
 
Physics news on Phys.org
  • #2
Follow this code:
Code:
syms t
eqn = 30==sqrt((800-320*t)^2+(410-160*t)^2);
s = simplify(eqn) %simplifies the equation
p = [160 -804 1009]; %the coefficients in decreasing power of t
r = roots(p)
The simplified equation is 160*t^2 - 804*t + 1009 = 0.

The roots come out to be exactly what you've found using Wolfram Alpha.

Here is the documentation for the roots function:
https://in.mathworks.com/help/matlab/ref/roots.html
 

1. What is MATLAB and how is it used in finding when aircraft are 30 miles apart?

MATLAB is a software program used for numerical computing and data analysis. In this scenario, it can be used to solve equations and find the roots, or solutions, which indicate when the distance between two aircraft reaches 30 miles.

2. What is the significance of using roots to find when aircraft are 30 miles apart?

Using roots is an efficient and accurate method for solving equations and finding specific points, such as when the distance between two moving objects reaches a certain value. It allows for precise calculations and can be easily implemented in MATLAB.

3. How do you input the necessary data into MATLAB to find when aircraft are 30 miles apart?

The necessary data, such as the initial positions and velocities of the aircraft, can be inputted as variables in MATLAB. These variables can then be used in the equation for the distance between the aircraft to solve for the time when it reaches 30 miles.

4. Can MATLAB be used to find when more than two aircraft are 30 miles apart?

Yes, MATLAB can be used to find when any number of aircraft are 30 miles apart. The equation and method for finding the roots would remain the same, but the initial positions and velocities of each aircraft would need to be inputted as separate variables.

5. Are there any limitations to using roots in MATLAB to find when aircraft are 30 miles apart?

One limitation is that the equation used to find the distance between the aircraft may not accurately account for external factors such as wind or changes in velocity. Additionally, if the initial positions or velocities are not accurately measured, the results may not be precise.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
4
Views
902
  • Advanced Physics Homework Help
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top