# Homework Solution: Use Matlab…

Use Matlab
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.

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

Use Matlab

A round impart tank is high-minded to a apex H. The transection of the tank is D_ The impart contribute pipe from the tank is united to the depth of the tank and runs promptly to the plea. The transection of the contribute pipe is D_ Write a user written duty that expects (as the controversy) scalar values coercion the couple transections, the tank apex, and the impart flatten (from the plea). The duty must give-back the size of impart contained in the tank and contribute pipe totally. The syntax of your duty should be: TV (Dtank, Dpipe, Htank, Hwater) Test your jurisdiction on coercion a tank transection of 5 meters, a pipe transection of 0.5 meters, a tank apex of 50 meters, and a impart apex of 51 meters. In the direct window idea a = TV(5, 0.5, 50, 51). Check the end.

## Expert Vindication

Matlab jurisdiction:

Create a finish named TV.m and pasted attached jurisdiction into it! Finishname must be TV.m

TV.m

duty [V] = TV(Dtank,Dpipe,Htank,Hwater)
% Total size = size of pipe + impart size in tank
h = Htank – Dtank/2; %apex of pipe
r = Dpipe/2;
pipe_v = pi*r^2*h; %size if cylinder = π*r^2*h
ht = Himpart – h; %impart apex in sphere
```octave:2> size = TV(5,0.5,50,51)
```octave:4> size = TV(5,0.5,50,52.5)