Probobly basic but I've been trying for hours with Googleing and trying different things. Any help would be appricated.
All I'm trying to do is substitute the known variables (a,b,c) into eqn2 in this case and I cannot get S to spit out 1000 as I think it should.
Code:
a = -500;
b = 433;
c = -866;
syms a b c
eqn2 = (-0.5*a-0.866*c) == 1000;
S = solve(eqn2,[a,c])

 採用された回答

Star Strider
Star Strider 2020 年 11 月 11 日

0 投票

With the values you provided, ‘eqn2’ equates to 0, so there is nothing to solve for.
That aside, you are solving one equation for two unknowns, so you will likely not get the result you intend:
syms a b c
% a = -500;
b = 433;
% c = -866;
eqn2 = (-0.5*a-0.866*c) == 1000;
S = solve(eqn2,[a,c]);
a = S.a
c = S.c
producing:
a =
-2000
c =
0
.

その他の回答 (0 件)

製品

質問済み:

2020 年 11 月 11 日

回答済み:

2020 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by