Question
in MATLAB
Label not Mi published script file your results (units) and plots accordingly. Answer with complete sentences from Matlab cro
0 0
Add a comment Improve this question Transcribed image text
Answer #1

From the figure we have

a^2=b_1^2+c_1^2-2b_1c_1\cos A_1 .......Eq.1

a^2=b_2^2+c_2^2-2b_2c_2\cos A_2 .......Eq.2

From Eq.1 and Eq.2

b_2^2+c_2^2-2b_2c_2\cos A_2=b_1^2+c_1^2-2b_1c_1\cos A_1

\Rightarrow b_2^2-2b_2c_2\cos A_2+c_2^2-b_1^2-c_1^2+2b_1c_1\cos A_1=0

\Rightarrow b_2^2+b_2(-2c_2\cos A_2)+(c_2^2-b_1^2-c_1^2+2b_1c_1\cos A_1)=0

b_2^2+k_1b_2+k_2=0 ......Eq.3

where k_1\ \&\ k_2 are constants given by k_1=-2c_2\cos A_2\ \&\ k_2=c_2^2-b_1^2-c_1^2+2b_1c_1\cos A_1

We need to solve the above equation (Eq.3) using MATLAB to find the solution for b_2

The MATLAB code to obtain the value of b_2 is shown below.

%cleaning the workspace
clear all
%clearing the command window
clc
%Prompting the user to enter the values of b1,c1,c2,A1 and A2
b1=input('Enter the length of b1 in meters:');
c1=input('Enter the length of c1 in meters:');
c2=input('Enter the length of c2 in meters:');
A1=input('Enter the angle A1 in degrees:');
A2=input('Enter the angle A2 in degrees:');
%calculating the constants k1 and k2
k1=-2*c2*cos(A2*pi/180);
k2=c2^2-b1^2-c1^2+2*b1*c1*cos(A1*pi/180);
%obtaining the roots of b2^2+k1*b2+k2=0
r=roots([1 k1 k2]);
%assiging the positive roots of the above equation to b2 which is the real
%solution
b2=r(r>0);
%displaying the length of b2 on the command window.
fprintf('The length of b2 is %4.4f m\n',b2)

The output on the command window for the test case inputs is

Enter the length of b1 in meters:140
Enter the length of c1 in meters:120
Enter the length of c2 in meters:100
Enter the angle A1 in degrees:110
Enter the angle A2 in degrees:130
The length of b2 is 134.7781 m

Add a comment
Know the answer?
Add Answer to:
Label not Mi published script file your results (units) and plots accordingly. Answer with comple...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please answer 1c, use MATLAB, and paste your entire script in your answer so that I...

    Please answer 1c, use MATLAB, and paste your entire script in your answer so that I can copy and paste to see if it works. Problem #1 400g triangle square pentagon hexagon Figure 1 For a closed geometric figure composed of straight lines (Figure 1), the interior angles in the figure must add to (n-2)(180) where n is the number of sides. Required Tasks a) Write a script that prompts the user to select from one of the following shapes:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT