MATLAB Answers

Need Help New to MATLAB

21 views (last 30 days)
Corey Kado
Corey Kado on 24 Oct 2020 at 23:31
Commented: Star Strider on 25 Oct 2020 at 19:10
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.

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 25 Oct 2020 at 1:10
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 Comments

Show 1 older comment
Star Strider
Star Strider on 25 Oct 2020 at 18:42
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 on 25 Oct 2020 at 19:06
Thank you very much. That cleared up mu confusion about the substitution function as well.
Star Strider
Star Strider on 25 Oct 2020 at 19:10
As always, my pleasure!
Thank you!

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!