Date: Jan 28, 2013 10:20 AM
Subject: Re: Guess age function
"Chan Khoa" wrote in message <firstname.lastname@example.org>...
> 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.