Triangle Matlab Program

 

 

%%Triangle Matlab Program Design By Erik Rosado | www.erikrosado.com

%% Input Values:

x = input (‘ Enter value for Adjacent: ‘ )

y = input (‘ Enter value for Opposite: ‘ )

%% Equations:

z = (sqrt(x.^2 + y.^2));

ang = atand(y./x);

%% Result display values:

Hypotenuse = z

Angle = ang

Matlab Command Windows:

 

Enter value for Adjacent: 5

x =

5

Enter value for Opposite: 10

y =

10

Hypotenuse =

11.1803

Angle =

63.4349