Need Help New to MATLAB

2 views (last 30 days)
Corey Kado
Corey Kado on 24 Oct 2020
Commented: Star Strider on 25 Oct 2020
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.

Accepted Answer

Star Strider
Star Strider on 25 Oct 2020
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
Corey Kado
Corey Kado on 25 Oct 2020
Thank you very much. That cleared up mu confusion about the substitution function as well.
Star Strider
Star Strider on 25 Oct 2020
As always, my pleasure!
Thank you!

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!