ps3solnsW06

ps3solnsW06 - %Engineering 6, Winter 2006, Problem 3.1...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
%Engineering 6, Winter 2006, Problem 3.1 Solution %(Shaded area in circle) %Suppress extra lines in output and set fixed short display format compact ; format short ; %Clear variables and command window clear; clc; %Set value of radius in cm r = 5; %Ask the user to input a value for the angle a in degrees a_degrees = input( 'Enter angle in degrees (0 to 180): ' ); %Convert angle to radians for later use a = (pi/180)*a_degrees; %Calculate the area of the circle circleArea = pi*r^2; %Calculate the area of the isoscoles triangle with sides % of length r and angle a triangleArea = (r*sin(a/2))*(r*cos(a/2)); %Calculate area of the wedge defined by r and a (using % the fact that the ratio of the wedge area to the circle % area is equal to the ratio of the angle a to 360 degrees % or 2pi radians) wedgeArea = (a/(2*pi))*circleArea; %Calculate shaded area and its percentage of the circle area shadedArea = wedgeArea - triangleArea; shadedPercentage = (shadedArea/circleArea)*100; %Display results disp( 'The shaded area, in square centimeters, is:' ); disp(shadedArea); disp( 'The total circle area, in square centimeters, is:' ); disp(circleArea); disp( 'The percentage of shaded to total area is:' ); disp(shadedPercentage); %Sample results: %Displayed results for angle = 0 degrees: %Enter angle in degrees (0 to 180): 0 %The shaded area, in square centimeters, is: % 0 %The total circle area, in square centimeters, is: % 78.5398
Background image of page 1

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

View Full DocumentRight Arrow Icon
%The percentage of shaded to total area is: % 0 %Displayed results for angle = 90 degrees: %Enter angle in degrees (0 to 180): 90 %The shaded area, in square centimeters, is: % 7.1350 %The total circle area, in square centimeters, is: % 78.5398 %The percentage of shaded to total area is: % 9.0845 %Displayed results for angle = 180 degrees:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

ps3solnsW06 - %Engineering 6, Winter 2006, Problem 3.1...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online