Question: Develop a MATLAB function called Forces, which has five input arguments: the magnitude and angle of Force 1 , the magnitude and angle of Force

Develop a MATLAB function called Forces, which has five input arguments: the magnitude
and angle of Force 1, the magnitude and angle of Force 2, and units for the angles (degrees or
radians). The function should first check for valid inputs. The magnitudes must be positive and
the units must be 'degrees' or 'radians' (also could use 'D' or 'R'). If any of the inputs are
invalid, the function should print a message to the user and terminate without returning any
values. If the inputs are valid, the function should compute the resultant force and return two
output arguments: the magnitude and angle of the resultant force. The angle should be in the
same units that the two forces were originally in.
To compute the resultant force:
Convert each force to rectangular form by calculating the x and y component of each
force:
Fx=|F|cos() and Fy=|F|sin()
Add the x -components of the forces to calculate Frx(the x -component of resultant force).
Add the y -components of the forces to calculate Fry(the y -component of resultant force).
Convert the resultant force from rectangular form to polar form as follows:
Fr=Frx2+Fry22 and r={atan(FryFrx),Frx0atan(FryFrx)+,Frx0
Save your function as Forces.m and then call it from MATLAB's command window to check
for accuracy.
Sample Output:
Assuming the following order for input arguments: Mag of F1, Angle of F1, Mag of F2, Angle of
F2, Units ('D' or 'R')
[F-r,Th-r]=Forces(10,180,5,90,D')
F-R=11.1803
TH-R=153.4349
Develop a MATLAB function called Forces, which

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!