4_Quarterman_Patrick_HW08B

4_Quarterman_Patrick_HW08B - cylinder only

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

View Full Document Right Arrow Icon
Patrick Quarterman Section 4, HW08B MATlab script: function [Volume] = Water_Tank(Height) %Patrick Quarterma, Section 4 %HW08B %inputs: height (m) %outputs: volume (m^3) %Given values R=2; %Radius for cylinder part in meters d=1.5; %depth of container in meters if Height>5*R %display error if H is too large or negative error( 'Overtop' ) elseif Height<0 error( 'Negative Height' ) end if Height<R %Calculate volume for when height is in
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cylinder only Volume=d*(R^2*acos((R-Height)/R)-R*(R-Height)*sin((acos((R-Height)/ R)))); elseif Height&gt;=R %calculate volume for Height is greater than cylinder height Volume=((pi*R^2*d)/2)+(Height-R)*d*2*R; end Command Window: &gt;&gt; Water_Tank(1.5) ans = 6.4563 &gt;&gt; Water_Tank(2.5) ans = 12.4248 &gt;&gt; Water_Tank(6) ans = 33.4248 &gt;&gt; Water_Tank(8.5) ans = 48.4248...
View Full Document

Page1 / 2

4_Quarterman_Patrick_HW08B - cylinder only

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

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