System of nonlinear equations

3 visualizaciones (últimos 30 días)
Aleem Andrew
Aleem Andrew el 12 de Feb. de 2020
Comentada: David Goodmanson el 13 de Feb. de 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;

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by