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

  • Thread starter Thread starter chevymechanic
  • Start date Start date
  • Tags Tags
    Matlab Roots
Click For Summary
SUMMARY

The discussion focuses on using the "roots" function in MATLAB to determine the time when two aircraft are within 30 miles of each other. The distance formula derived is D=sqrt((800-320*t)^2+(410-160*t)^2), and setting D to 30 leads to the equation 30=sqrt((800-320*t)^2+(410-160*t)^2). The simplified quadratic equation 160*t^2 - 804*t + 1009 = 0 is solved using the "roots" command, yielding the same results as Wolfram Alpha: t values of 2.43246 and 2.59254.

PREREQUISITES
  • Understanding of MATLAB syntax and functions
  • Familiarity with quadratic equations
  • Knowledge of distance formulas in a Cartesian plane
  • Basic proficiency in symbolic computation in MATLAB
NEXT STEPS
  • Explore the MATLAB "roots" function documentation for advanced usage
  • Learn about symbolic computation in MATLAB using the "syms" command
  • Study quadratic equations and their applications in physics
  • Investigate distance calculations in 2D space for various scenarios
USEFUL FOR

This discussion is beneficial for MATLAB users, aerospace engineers, and students studying physics or mathematics, particularly those interested in solving problems involving motion and distance calculations.

chevymechanic
Messages
13
Reaction score
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
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
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 41 ·
2
Replies
41
Views
10K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 11 ·
Replies
11
Views
12K
  • · Replies 4 ·
Replies
4
Views
3K