Using estimates of rainfall, evaporation, and water consumption, the town engine
ID: 1995845 • Letter: U
Question
Using estimates of rainfall, evaporation, and water consumption, the town engineer developed the following model of the water volume in the reservoir as a function of time Vt=109+1081-e-t100-rt where V is the water volume in liters, t is the time in days, and r is the town's consumption rate in liters per day. Write two-user-defined functions. The first function should define the function V(t) for use with the f zero function. The second function should use f zero to compute how long it would take for the water volume to decrease to x percent of its initial value of 109L. The inputs to the second function should be x and r. Test your functions for the case where x=50 percent and r=107L/day.Explanation / Answer
the matlab code having calling function and main function, please cafully excute it.
function diffV=deltaV(t1)%calling function for define the equation.
global Rd Xd
V_of_t1=10^9+10^8(1-exp(-t1/100))-Rd*t1;
Vfinal=10^9*(Xd/100);
diffV=Vfinal-V_of_t1;
main code:
function t1_dec=time_to_decrease(x1,r1)
global Rd Xd
Rd=r1
Xd=x1
t1_dec=fzero('deltaV',100)
x1i=input('percent of initial storage, x= ');
r1i=input('consumption rate for L/day, r= ');
disp('for x1= ')
disp(x1i)
disp(' for r1= ')
disp(r1i)
disp(' ')
disp(‘time for the decrease in the days = ')
disp(td)
the results will be dislayed as
the results are like:
percent of initial storage, x1= 50
consumption rate for L/day, r1= 1e7
for x1=
50
For r1=
10000000
time for the decrease in the days =
54.1832
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.