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.

Reference no: EM13626304

Questions Cloud

Refrigerant-134a is being transported at 1kgs through a : refrigerant-134a is being transported at .1kgs through a teflon tube of inside diameter di 25mm and outside diameter
Moreover the manufacturer believes the lifetime of the : suppose a car manufacturer believes its windscreen wipers will last on average for three years on their cars if driven
Write a function that accepts an array a as input and : write a function that accepts an array a as input and searches the contents of the array for elements in three
Consider a 2210 lb automobile clocked by law enforcement : consider a 2210 lb automobile clocked by law enforcement radar at a speed of 85.5 mph. if the position of the car is
Write a matlab script m-file to play a guessing game the : write a matlab script m-file to play a guessing game. the user will try to guess a number between 1 and 100. your
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

Reviews

Write a Review

 

MATLAB Programming Questions & Answers

  Z-transform in matlab

Z-Transform in MATLAB, Sketch the z-plane pole-zero plot and determine the stability status for the following digital system. Determine the h(n) in MatLab.

  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)

  Write a program that examines student in basic arithmetic

Write a program that examines the student in the basic arithmetic operations (summation, subtraction and multiplications).

  Determine the level of absolute approximate relative error

2006ENG Numerical and Data Analysis. Convert the equation into f(T) = 0 when cp of 1.1kJ/kgK. In our MATLAB program, develop a plot of f(T) versus a range of T = 0 to 1200 K. MATLAB. On the axes, put proper labelling.

  Write a matlab program to generate a data file

1.) Write a Matlab program to generate a data file containing the names and corresponding telephone numbers of the customers. 2.) Using the data file created, write a program in Matlab to create a menu-driven facility to preform the following tasks

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  Least squares

For homework consider the points (0,0), (1,2), (2,3), (3,9), ( 4,17), (5,24), (6,37). (1) Use Matlab to find the least squares best fit with a line.  Turn in A, y and c and a plot like the one above.  Also (2) use Matlab to find the least square best..

  Beginning with the row number passed

Write a MATLAB function that takes a matrix, a row number and a column number. Beginning with the row number passed to the function, scan down the column passed to the function and return the row number that contains the largest absolute value in ..

  Write a matlab function that takes a matrix

Write a MATLAB function that takes a matrix, a row number and a column number. Beginning with the row number passed to the function, scan down the column passed to the function and return the row number that contains the largest absolute value in ..

  Function that will use the secant method to try to find

Create a function that will use the Secant method to try to find a root. (Hint modify the posted version of False Position.) Because this method may diverge

  Filtering – biomedical application

Prepare a filter that removes noise produced by electronic medical equipment.

  Write a simple program that stores the high temperatures

A meteorological company wants you to write a simple program that stores the high temperatures and low temperates for each of the months of the year. After consulting with trusted programming partners, you come up with a great idea

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd