solution11

# solution11 - beta=acos(a.^2 c.^2-b.^2(2*a*c*180/pi...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
% Prob 2 Function file function [alpha,beta,gamma]=triangle(a,b,c) % 'triangle' calculates the interior angles of a triangle given the lengths % of its sides. % The inputs are the lengths of the three sides. a, b and c. % The outputs are the three angles alpha, beta and gamma. % alpha is the angle opposite side a. % beta is the angle opposite side b. % gamma is the angle opposite side c. % The angles are calculated using the law of cosines. % The angles are given in degrees. alpha=acos((b.^2+c.^2-a.^2)./(2*b.*c))*180/pi;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: beta=acos((a.^2+c.^2-b.^2)./(2*a.*c))*180/pi; gamma=acos((a.^2+b.^2-c.^2)./(2*a.*b))*180/pi; % Prob. 2 Script file a=10;b=15;c=7; [alpha,beta,gamma]=triangle(a,b,c); fprintf('alpha=%5.2f deg, beta=%5.2f deg, gamma=%5.2f deg\n',alpha,beta,gamma) alpha=34.05 deg, beta=122.88 deg, gamma=23.07 deg disp(' ') a=6;b=8;c=10; [alpha,beta,gamma]=triangle(a,b,c); fprintf('alpha=%5.2f deg, beta=%5.2f deg, gamma=%5.2f deg\n',alpha,beta,gamma) alpha=36.87 deg, beta=53.13 deg, gamma=90.00 deg...
View Full Document

## This note was uploaded on 02/27/2010 for the course ENME 271 taught by Professor Marks during the Summer '08 term at Maryland.

### Page1 / 2

solution11 - beta=acos(a.^2 c.^2-b.^2(2*a*c*180/pi...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online