]> Exercises

Exercises

Please complete each exercise or answer the question before reviewing the posted solution comments.

  1. You are working with a tank that has a radius that varies by height according to the following relationship (all measurements in feet): r ( h ) = h 2 + 1 3 h 3 MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbeqabeWacmGabiqabeqabmaabaabaaGcbaGaamOCaiaacIcacaWGObGaaiykaiabg2da9iaadIgadaahaaWcbeqaaiaaikdaaaGccqGHRaWkdaWcaaqaaiaaigdaaeaacaaIZaaaaiaadIgadaahaaWcbeqaamaakaaabaGaaG4maaadbeaaaaaaaa@4074@

    We can find the volume of a container with varying radius by using the following expression: V = 0 h π r ( h ) 2 d h MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbeqabeWacmGabiqabeqabmaabaabaaGcbaGaamOvaiabg2da9maapehabaGaeqiWdaNaamOCaaWcbaGaaGimaaqaaiaadIgaa0Gaey4kIipakiaacIcacaWGObGaaiykamaaCaaaleqabaGaaGOmaaaakiaadsgacaWGObaaaa@43B2@

    Therefore, the integral we need to evaluate to find the volume of a tank that is H feet high and a radius that is a function of height according to r(h) above, is: V = 0 H π ( h 2 + 1 3 h 3 ) 2 d h MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbeqabeWacmGabiqabeqabmaabaabaaGcbaGaamOvaiabg2da9maapehabaGaeqiWda3aaeWaaeaacaWGObWaaWbaaSqabeaacaaIYaaaaOGaey4kaSYaaSaaaeaacaaIXaaabaGaaG4maaaacaWGObWaaWbaaSqabeaadaGcaaqaaiaaiodaaWqabaaaaaGccaGLOaGaayzkaaaaleaacaaIWaaabaGaamisaaqdcqGHRiI8aOWaaWbaaSqabeaacaaIYaaaaOGaamizaiaadIgaaaa@4825@

    Use Matlab to determine the volume (evaluate the integral) for such a tank that is 5 feet high: V = 0 5 π ( h 2 + 1 3 h 3 ) 2 d h MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbeqabeWacmGabiqabeqabmaabaabaaGcbaGaamOvaiabg2da9maapehabaGaeqiWda3aaeWaaeaacaWGObWaaWbaaSqabeaacaaIYaaaaOGaey4kaSYaaSaaaeaacaaIXaaabaGaaG4maaaacaWGObWaaWbaaSqabeaadaGcaaqaaiaaiodaaWqabaaaaaGccaGLOaGaayzkaaaaleaacaaIWaaabaGaaGynaaqdcqGHRiI8aOWaaWbaaSqabeaacaaIYaaaaOGaamizaiaadIgaaaa@4817@

    First, define a function that returns the cross-sectional area of the tank at a specified height.

              function xarea = tank_cross_section(h)
              % Returns the cross-sectional area of a tank
              xarea = pi*(h.^2+(1/3)*h.^sqrt(3)).^2;
            

    Notice the periods, this is so that the function still will work when a matrix is passed to it. This allows the quad function to have the function evaluate more than one value at a time. This ability is required for quad to correctly determine the result.

    Compute the value by typing:

              >> quad('tank_cross_section',0,5)
            

    Matlab will return with ans = 2.9652e+003 In other words, our tank volume is 2965.2 cubic feet. Remember, if you plan to use this value again, name it (such as TVol = quad('tank',0,5). That way, TVol = 2965.2)

    Note: Although it is good programming practice to define the function in a separate M-file, the quad function can be executed with the single line:

              >> TVol = quad('pi*(h.^2+(1/3)*h.^sqrt(3)).^2',0,5)