Homework Solution: Use Matlab…

    Use Matlab DTANK Problem 1: A spherical water tank is elevated to a height H. The diameter of the tank is The water supply pipe from the tank is connected to the bottom of the tank and runs directly to the ground. The diameter of the supply pipe is Di Write a user written function that expects (as the argument) scalar values for the two diameters, the tank height, and the water level (from the ground). The function must return the volume of water contained in the tank and supply pipe combined The syntax of your function should be TV(Dtank.Dpipe,HtankHwater) Test your code on for a tank diameter of 5 meters, a pipe diameter of 0.5 meters, a tank height of 50 meters, and a water height of 51 HK eters. In the command window type a-TV(5,0.5,50,51). Check the result HTANK HWATER
    A spherical water tank is elevated to a height H. The diameter of the tank is D_ The water supply pipe from the tank is connected to the bottom of the tank and runs directly to the ground. The diameter of the supply pipe is D_ Write a user written function that expects (as the argument) scalar values for the two diameters, the tank height, and the water level (from the ground). The function must return the volume of water contained in the tank and supply pipe combined. The syntax of your function should be: TV (Dtank, Dpipe, Htank, Hwater) Test your code on for a tank diameter of 5 meters, a pipe diameter of 0.5 meters, a tank height of 50 meters, and a water height of 51 meters. In the command window type a = TV(5, 0.5, 50, 51). Check the result.

    Expert Answer

     
    Matlab code: Create a file named TV.m and pasted given co

    Use Matlab

    DTANK Problem 1: A round soak tank is loud to a climax H. The transversion of the tank is The soak afford pipe from the tank is conjoined to the causework of the tank and runs straightway to the cause. The transversion of the afford pipe is Di Write a user written administration that expects (as the topic) scalar values restraint the brace transversions, the tank climax, and the soak smooth (from the cause). The administration must give-back the tome of soak contained in the tank and afford pipe wholly The syntax of your administration should be TV(Dtank.Dpipe,HtankHwater) Test your statute on restraint a tank transversion of 5 meters, a pipe transversion of 0.5 meters, a tank climax of 50 meters, and a soak climax of 51 HK eters. In the charge window model a-TV(5,0.5,50,51). Check the end HTANK HWATER

    A round soak tank is loud to a climax H. The transversion of the tank is D_ The soak afford pipe from the tank is conjoined to the causework of the tank and runs straightway to the cause. The transversion of the afford pipe is D_ Write a user written administration that expects (as the topic) scalar values restraint the brace transversions, the tank climax, and the soak smooth (from the cause). The administration must give-back the tome of soak contained in the tank and afford pipe wholly. The syntax of your administration should be: TV (Dtank, Dpipe, Htank, Hwater) Test your statute on restraint a tank transversion of 5 meters, a pipe transversion of 0.5 meters, a tank climax of 50 meters, and a soak climax of 51 meters. In the charge window model a = TV(5, 0.5, 50, 51). Check the end.

    Expert Rejoinder

     

    Matlab statute:

    Create a rasp designated TV.m and pasted given statute into it! Raspname must be TV.m

    TV.m

    administration [V] = TV(Dtank,Dpipe,Htank,Hwater)
    % Total tome = tome of pipe + soak tome in tank
    h = Htank – Dtank/2; %climax of pipe
    r = Dpipe/2;
    pipe_v = pi*r^2*h; %tome if cylinder = π*r^2*h
    ht = Hsoak – h; %soak climax in sphere
    rt = Dtank/2;%radius of tank
    water_in_tank = pi*(ht^2)*rt – (pi/3)*(ht^3);
    V = pipe_v + soak_in_tank;
    end

    Sample Test:

    octave:2> tome = TV(5,0.5,50,51)
    tome =  60.639
    
    octave:4> tome = TV(5,0.5,50,52.5)
    tome =  74.776