The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Guess age function
Replies: 1   Last Post: Jan 28, 2013 10:20 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  

Posts: 2,359
Registered: 12/6/04
Re: Guess age function
Posted: Jan 28, 2013 10:20 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Chan Khoa" wrote in message <ke63ns$d3t$>...
> I'm new to MatLab and stuck at this problem can anyone one help?
> Write the function guessAge(range) where range is the range which the exact age is in. This
> function can only ask the user Yes/No questions and receive the answer from the user. Using
> the answer, the function continues to ask if it cannot guess the age correctly. Otherwise, the
> function displays and returns the guessed age.
> Requirements: the function cannot ask all numbers in the given range. It needs to minimize the
> number of questions asked.

Try adapting the Bisection Method:


If you are having problems coding this in MATLAB, try reading the "Getting Starting" guide that comes with MATLAB (or is available online at MathWorks). It is a quick read and (with the examplkes) should answer most of your questions.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.