System of nonlinear equations

3 ビュー (過去 30 日間)
Aleem Andrew
Aleem Andrew 2020 年 2 月 12 日
コメント済み: David Goodmanson 2020 年 2 月 13 日
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;

採用された回答

David Goodmanson
David Goodmanson 2020 年 2 月 12 日
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 件のコメント
darova
darova 2020 年 2 月 13 日
Remember about accepting the answer
David Goodmanson
David Goodmanson 2020 年 2 月 13 日
thank you darova and aleem

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by