I have this problem in my Matlab programming class, and would like some help wit
ID: 3650971 • Letter: I
Question
I have this problem in my Matlab programming class, and would like some help with the two functions, please show both functions and code.
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
V(t)=109+108(1?e?t/100)?rt
whereVis the water volume in liters,tis time in days, and r is the town%u2019s consumption rate in liters per day. Write two user-defined functions. The first function should define functionV(t)to evaluateVfor any input oft. The second function should usefzeroto compute how long it will take for the water volume to decrease toxpercent of its initial value of 109Liters. The inputs to the second function should bexandr. Test your functions for the case wherex= 50 percent andr= 10^7 Liters/day.
[Please copy and paste your first function here]
[Please copy and paste your second function here]
[Please copy and paste the code and results of testing your functions here]
[Please copy and paste your first function here]
Explanation / Answer
A) function diffV = deltaV(t); %UNTITLED Summary of this function goes here % Detailed explanation goes here global rd xd rd = input('Enter a rate of water consumption: '); xd = input( 'Enter a percent of initial volume: '); VoT = 10e9 + 10e8*(1 -exp(-t./100)) - (rd).*t Vfinal = 10e9 *(xd/100) diffV = VoT- Vfinal end And for my second function piece of code I have come up with : function t_dec = time_todecrease(xd ,rd) global xd rd t_dec = fzero('deltaV',10) xd rd B) The MATLAB function fzero finds zero points for a function with a single variable. One could imagine: [1] V/V0 = f(x) where V is the volume, and V0 is the initial volume. If V = V0, then you have 100% of the original volume. Rearranging: [2] f(x) - V/V0 = 0 answer