Azzera filtri
Azzera filtri

I need to determine the flight time and name it P2A and I am having a hard time because it is returning as 0

1 visualizzazione (ultimi 30 giorni)
I am using Matlab and this is my code so far.
a=4
b=2
c=7
d=13
syms t
abs(t)
vo=45+a;
do=.044+(b/50)
yo=1
g=9.81
x=(vo*cos(do))*t
y=-(g/2)*t^2+(vo*sin(do))*t+yo
I need to ensure that "t" only takes on postive values and I need to determine the flight time of the baseball using solve and double. Finally I need to call this result P2A
Can you pls help?

Risposta accettata

Devesh Bhasin
Devesh Bhasin il 10 Nov 2022
Hi Jaden,
For using the 'solve' function, I recommend going through the the examples in the function's documentation. The following is one relevant example that shows the use of 'solve' function to get real solutions:
For the condition that 't' needs to be positive, the following are the alternatives:
1. You can include the equation 't>0' in your system of equations as an input to the 'solve' function.
2. You can call the assume function before solving the equations as:
assume(t>0)
For more information, please refer to the following documentation for the 'assume' function:
3. You can solve for 't^2' instead of 't' and then square the resulting solution at the end. This method is explained in the following MATLAB Answers post:
https://www.mathworks.com/matlabcentral/answers/164468-how-to-make-sure-that-fsolve-gives-only-positive-values-as-the-solution

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by