System of nonlinear equations

4 Ansichten (letzte 30 Tage)
Aleem Andrew
Aleem Andrew am 12 Feb. 2020
Kommentiert: David Goodmanson am 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;

Akzeptierte Antwort

David Goodmanson
David Goodmanson am 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 Kommentare
darova
darova am 13 Feb. 2020
Remember about accepting the answer
David Goodmanson
David Goodmanson am 13 Feb. 2020
thank you darova and aleem

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by