System of nonlinear equations

4 visualizzazioni (ultimi 30 giorni)
Aleem Andrew
Aleem Andrew il 12 Feb 2020
Commentato: David Goodmanson il 13 Feb 2020
I have tried the following code to solve a system of nonlinear equations, but it does not return the correct result which can be found on Wolfram Alpha: https://www.wolframalpha.com/input/?i=10cos15+%28%28t%2B+%282%29%2845-10sin%2815%29t%29%2F%2810sin15%2Bsqrt%2819.6*%2845-10sin%2815%29t%29%29%29%29%29+%3D+40
Can anyone suggest how I should modify the code? I want to store the value of t in another variable r that can be used for later computations.
syms t y a
%b(1) = 10*cos(15)*((t+ 2*(45-10*sin(15)*t)/(10*sin(15)+sqrt(19.62*(45-10*sin(15)*t)))))-40;
b(1) = (10*cos(15)*((t+ 2*(45-10*sin(15)*t))))*power(( 10*sin(15)+sqrt(19.62*(45-10*sin(15)*t))),-1)-40;
z = solve(b,t,y);
Xsoln = simplify(z.t);
subs(Xsoln,a)
r = a;

Risposta accettata

David Goodmanson
David Goodmanson il 12 Feb 2020
Hi Aleem,
Wolfram Alpha is solving this numercially not analytiaclly so you might as well, too.
b = @(t) 10*cosd(15)*(t+ 2*(45-10*sind(15)*t)/(10*sind(15)+sqrt(19.6*(45-10*sind(15)*t))))-40;
fzero(b,1)
ans =
1.4850
One important change here is that you have to use sind(theta) instead of sin(theta) since the angles are in degrees. Also I changed 19.62 to 19.6, otherwise the answer will disagree with Wolfram Alpha.
  3 Commenti
darova
darova il 13 Feb 2020
Remember about accepting the answer
David Goodmanson
David Goodmanson il 13 Feb 2020
thank you darova and aleem

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Mathematics 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