Is this assignment for a grade?
The problem reads like so:
Using estimates of rainfall, evaporation, etc. The town engineer developed the following model for the amount of water in the town reservoir as a function of time:
where V is water volume in liters, t is time in days, and r is the towns consumption rate in liters per day. Write two user defined functions. The first function should define V(t) for use with the fzero function. The second function should use fzero to compute how long it will take for the water to decrease to percent of its initial value of L. The inputs of the second function should be and .
to be totally honest I don't have the foggiest of an idea on where to start. I'm not looking for anyone to hand me the answer, I just want to be pointed in the right direction.
The return value can be an array object, as can the arguments. The function needs to be placed in a .m file with the same name as the function on on the Matlab search path (IIRC the editor will offer to add the location to the search path when you save the file).Code:function rv=FnName(x,y,z) u=x+y; rv=0; if u>0 rv=x+y+z^2; else rv=7; end