1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB FZERO Help

  1. Sep 13, 2009 #1
    1. The problem statement, all variables and given/known data
    Using estimates of rainfall,evaporation, and water consumption, the town engineer developed the following model of water volume in the reservoir as a function of time:

    V(t) = (10^9) + (10^8)(1-(e^-t/100)) -rt

    where V is teh water volume in liters, t is time in days, and r is the town's consumption rate in liters/day. Write two user defined functions. The first function should define the function V(t) for use with the fzero function. The second function 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^9L. The inputs to the second function should be x and r. Test your functions for case where x = 50 percent and r = 10^7 L/day.



    2. Relevant equations



    3. The attempt at a solution
    Im not really sure how to tackle this problem> I went to the MATLAB help and did their examples on fzero but this just seems to be a lot different. Thanks
     
  2. jcsd
  3. Sep 13, 2009 #2
    Part A:

    Check out example 3 on http://www.mathworks.com/access/helpdesk_r13/help/techdoc/ref/fzero.html

    You are supposed to write "f.m" for this problem.

    Part 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

    What will the roots of the LHS of [2] represent?
     
  4. Sep 15, 2009 #3
    Re:URGENT MATLAB FZERO Help

    For my code of the first function i havecome up with :
    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

    end

    This sorta works but does not give me the time it took to decrease. Any ideas with whats wrong with my code?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: MATLAB FZERO Help
  1. Matlab help (Replies: 2)

  2. Matlab help (Replies: 2)

  3. Help with matlab (Replies: 7)

  4. MATLAB help (Replies: 2)

Loading...