Homework Solution: User written functions and nested loops A spherical water tank is elevated to a height H. The diameter of the tank is D_ The wate…

    This question needs to be wrtten in Matlab coding. Lecture Homework 2: User written functions and nested loops DTANK Problem 1: A spherical water tank is elevated to a height H. The diameter of the tank is Dask: 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 Done. 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) HWATER Test your code on for a tank diameter of 5 meters, a pipe diameter of oS meters, a tank height of 50 meters, and a water height of 51 meters. In the command window type a-IVS,0.5,50,51). Check the result.
    User written functions and nested loops 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

     
    function [vol] = TV (Dt,Dp,Ht,Hw)

    This inquiry needs to be wrtten in Matlab coding.

    Lecture Homework 2: User written administrations and nested loops DTANK Problem 1: A round insinuate tank is aggravated to a tallness H. The transection of the tank is Dask: The insinuate give pipe from the tank is alike to the cause of the tank and runs straightly to the cause. The transection of the give pipe is Done. Write a user written administration that expects (as the dispute) scalar values coercion the two transections, the tank tallness, and the insinuate raze (from the cause). The administration must recompense the quantity of insinuate contained in the tank and give pipe thoroughly. The syntax of your administration should be: TV Dtank, Dpipe,Htank Hwater) HWATER Test your adjudication on coercion a tank transection of 5 meters, a pipe transection of oS meters, a tank tallness of 50 meters, and a insinuate tallness of 51 meters. In the order window image a-IVS,0.5,50,51). Check the consequence.

    User written administrations and nested loops A round insinuate tank is aggravated to a tallness H. The transection of the tank is D_ The insinuate give pipe from the tank is alike to the cause of the tank and runs straightly to the cause. The transection of the give pipe is D_ Write a user written administration that expects (as the dispute) scalar values coercion the two transections, the tank tallness, and the insinuate raze (from the cause). The administration must recompense the quantity of insinuate contained in the tank and give pipe thoroughly. The syntax of your administration should be: TV Dtank, Dpipe,Htank Hwater) Test your adjudication on coercion a tank transection of 5 meters, a pipe transection of 0.5 meters, a tank tallness of 50 meters, and a insinuate tallness of 51 meters. In the order window image a = TV(5, 0.5, 50, 51). Check the consequence.

    Expert Tally

     

    administration [vol] = TV (Dt,Dp,Ht,Hw)
    Lp = Ht -(Dt)/2;
    Vp = pi*Lp*Dp*Dp/4;
    l = Hw-Lp;
    c = sqrt(l*(Dt/2 *2 – l));
    Vs = pi/6 *l*(3*c*c + l*l);
    v = Vs+Vp;
    v
    endfunction