I am new to MATLAB and have been assigned to do some problems, here is the one I am stuck on. Firstly I have been given some vectors that I have to find the rectangular form of and secondly I then have to find the magnitude of the two of the vectors. Here is the code I have come up with so far
syms F1 F2
Force = 125;
Theta1 = -90;
Theta2 = 180;
Theta3 = 41.7;
Fwx = Force*cosd(Theta1);
Fwy = Force*sind(Theta1);
F1x = cosd(Theta2)*F1;
F1y = sind(Theta2)*F1;
F2x = cosd(Theta3)*F2;
F2y = sind(Theta3)*F2;
vFw = Fwx+Fwy*j
vF1 = F1x+F1y*j
vF2 = F2x+F2y*j
solve(Fwy+F1y+F2y == 0,F2)
solve(Fwx+F1x+F2x == 0,F1)
It works out in the end almost, however there are a few issues and they most relate to the F2 components. In the vF2 it gives me the correct answer, but in an arbitraily large fraction that though correct I do not believe is satisfactory. In the solve for the F2 the same issue arises, a large fraction that is technically correct. The last thing I am having an issue with is that solve for F1 requires the answer from solve for F2 in order to be solved completely, but once again it appears that it will give me a really large fraction. Any and all help would be great.

 採用された回答

Star Strider
Star Strider 2020 年 10 月 25 日

0 投票

To make them not be fractions, use vpasolve or vpa on the result:
F2s = vpasolve(Fwy+F1y+F2y == 0,F2)
F1s = vpasolve(Fwx+F1x+F2x == 0,F1)
.

4 件のコメント

Corey Kado
Corey Kado 2020 年 10 月 25 日
Thanks you that fixed it up a whole lot. Now on my final answer, the solve for F1, I get a decimal*F2, which if you put it into a calculator with the result of F2 it is correct. Anyway I can bring the result of the solve for F2 into that answer? Maybe a substitution but I am not too sure.
Star Strider
Star Strider 2020 年 10 月 25 日
My pleasure!
Substitution is definitely the way to go:
F2s = vpasolve(Fwy+F1y+F2y == 0,F2)
F1s = vpasolve(Fwx+F1x+F2x == 0,F1)
F1s_full = subs(F1s,F2,F2s)
producing:
F2s =
187.90483495742954219540652854913
F1s =
0.74663818228539136079291438363725*F2
F1s_full =
140.29692441525165732593942477091
As requested!
Corey Kado
Corey Kado 2020 年 10 月 25 日
Thank you very much. That cleared up mu confusion about the substitution function as well.
Star Strider
Star Strider 2020 年 10 月 25 日
As always, my pleasure!
Thank you!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

質問済み:

2020 年 10 月 24 日

コメント済み:

2020 年 10 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by