### Write a matlab script m-file to play a guessing game the

Assignment Help MATLAB Programming
##### Reference no: EM13626304

Write a MATLAB script M-file to play a guessing game. The user will try to guess a number between 1 and 100. Your program will guide them to the right answer. Sample play should look like this:

Enter a number between 1 and 100 --> 50

Guess lower!

Enter your next guess --> 25

Guess higher!

Enter your next guess --> 33

Guess lower!

Enter your next guess --> 28

Congratulations! You got it in 4 guesses

Use the input command to obtain the guesses from the user. Note that you will be keeping track of how many guesses the user makes until the right answer is guessed.

This command generates a random number between 1 and 100: randi(100)

Optional improvements:

• Giving a special message for getting it on the first try.

• Giving a warning or error message if the user enters a number that is not between 1-100.

• Giving a warning or error message if the user does not enter a higher or lower number as instructed.

### Previous Q& A

#### What is the uncertainity in the position of an electron

german physicist werner heisenberg related the uncertainity of an objects position triangle x to the uncertainity in

#### A heat engine accepts 200000 btu of heat from a source at

a heat engine accepts 200000 btu of heat from a source at 1500 r and rejects 100000 btu of heat to a sink at 600 r.

#### Suppose tarzan leaps from the top of a 60-m tall building

suppose tarzan leaps from the top of a 60-m tall building. if his initial speed is 24 ms and at an angle of 23 degrees

#### A refrigerant at -40degc flows inside a copper pipe inside

a refrigerant at -40degc flows inside a copper pipe inside diameter 3 cm outside diameter 3.4 cm with a convective

#### A 60-kg wrecking ball b is attached to a 15-m-long steel

a 60-kg wrecking ball b is attached to a 15-m-long steel cable ab and swings in the vertical arc shown. determine the

#### How far will the cookie slide in m from the position where

a large fake cookie sliding on a horizontal surface is attached to one end of a horizontal spring with spring constant

#### What is the probablity that a person selected at random

what is the probablity that a person selected at random from this hwas data set is horter than 65 or taller than

#### What is the name or notation given to a value for which 61

what is the name or notation given to a value for which 61 of the sample data is smaller and 39 of the sample data is

#### Te acceleration of a package sliding at point a is

the acceleration of a package sliding at point a is . assuming that the coefficient of kinetic friction is the same for

#### Find the range and the standard deviation correct to two

find the range and the standard deviation correct to two decimal places. 83 96 99 99

### Similar Q& A

#### Rearranging preceding relationship between moles and mass

Create a function M-file called mass that requires two vector inputs-the number of moles and the molecular weight-and returns the corresponding mass. Because you are providing vector input, it will be necessary to use the meshgrid func..

#### Calculate the geometric mean of numbers

Write a program to calculate the geometric mean of numbers entered by a user. The program should prompt the user to enter numbers and continue to accept the numbers until the user enters 999.

#### Develop your own matlab function for the fixed-point method

Develop your own Matlab function for the Fixed-point method. Use the approximate relative error as your stopping criterion. The first line of your function should be function [root,froot,ea,iter] = fixedpoint(func,xr,es,maxit)

#### A good way to structure this program

A good way to structure this program is to read in each "number" as a string of characters, look at the first character to determine what kind of number it is (hex, binary, decimal), and then call an appropriate function to convert the string into..

#### Matlab: create a function that will use the secant method

MATLAB: Create a function that will use the Secant method

#### An efficient human identification using gait analysis

An Efficient Human Identification Using Gait Analysis, Apply specific approach for Pattern Recognition,Implement this approach in MATLAB,Compare and discuss the results with others.

#### Write a matlab function that would simulate rolling a biased

Write a MATLAB function that would simulate rolling a biased ("lucky") die N times; i.e., the function must return face values of N rolls of a biased die (N is a function input).

#### Image segmentation by matlab hi therewhat i need in this

hi there ltbrgt ltbrgtwhat i need in this order is that quotimage segmentationquot. choose any two obvious photos and

#### In matlab to illustrate the different format specifiers

1.) Write a program in matlab to illustrate the different format specifiers that can be used for obtaining formatted output.

#### Create a function that returns true i

Create a function that returns true if the input is a numeric matrix and false otherwise.

#### Matlab polyfit and polyval functions

Include the original photograph of your selected profile with your assignment. Trace your drawing on a graph paper. For convenience you can rotate the given profile.

#### Design simple interface hardware

Evaluate the capability in selecting and configuring a microcontroller unit designing simple interface hardware and writing subroutines to operate those interfaces