water volume in the reservoir as a function of time V(t)=10^9 + 10^8*(1-e^(-t/100)) - r*t where V is the water volume in liters, t is time in days and r is the town's consumption rate in liters per day. Write 2 user defined functions. The first function should define the function V(t) for use with the fzero function. The second duction should use fzero to compute how long it will take for the water volume to decrease to x percent of its initial value of 10^9 L. The inputs to the second function should be x and r. Test your functions for the case where x = 50 percent and r = 10^7 L/day.
Its a matlab question.. i'm having some trouble with it
function f= fun(t) global r f=(10^9)+(10^8)*(1-exp(-t/100))-(r*t); then global r r=10^7; x=50/100; c2=(-x*(10^9)); c1=10^9; c0=[c2,c1]; t=fzero('fun',c0) but then i get ??? Error using ==> fzero at 260 Function values at interval endpoints must be finite and real. Error in ==> test at 18 t=fzero('fun',c0)
Join our real-time social learning platform and learn together with your friends!