Calculate the geometric mean of numbers

Assignment Help MATLAB Programming
Reference no: EM13164600

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.

Note: Do not include 999 when calculating the average.

The geometric mean of a set of numbers (x1, x2, ... xn) is given by:

(X1 * X2 ...Xn)^ 1/n

For example, the geometric mean of 3, 5, 7 and 9:

(3*5*7*9)^ 1/4 = 5.5444

The flow of the program should be as follows:

  1. Prompt the user to enter a number
  2. User enters a number
  3. Process the number
  4. Program continues to prompt user to enter numbers (repeat steps 1-3) until user enters 999
  5. Program displays the message 'The geometric mean is ' and then prints the mean of all the entered numbers (excluding 999) to the screen

Reference no: EM13164600

Questions Cloud

Reads from the external file input.txt : Program that reads from the external file input.txt, counts the letters in every word, replaces the word by that number, and then writes the numbers to an external file output.tx
Design a program that extends the definition of the class : Design a program that extends the definition of the class JFrame to display a window on the screen. Name your class PropertyTax1, title your window "Calculation of Property Taxes," set the window's width to 400 pixels and height to 300 pixels, and te..
Program to keep track of the participants in a triathlon : Create a program to keep track of the participants in a triathlon. Your program will keep track of the times in three events: Running, Swimming, and Biking. Your program will calculate who is the winner in the Male category and the Female category..
Write an abstract class carbon footprint : Using an abstract class with only pure virtual functions, create three small classes unrelated by inheritance---clases Building, Car and Bicycle.
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.
Make a fourth button called special : Make a fourth button called "special" that does something else notdescribed in the assignment, such as change the background color.
Write a c function called values that returns void : Write a C function called values that returns void and takes two double precision arguments (called a and b) and one double precision array argument.
Trojan horse defense : Using your favorite search engine, look up "Trojan Horse Defense". How can it be used to question the conclusions drawn from a forensic investigation? Site a case where it was used.
Write a java program that uses a search tree of strings : Write a Java program that uses a search tree of strings to sort text lines in alphabetic order. You may choose how you de?ne alphabetic order as long as there is some sense in the de?nition. You may also choose what kind of tree you use.

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Plot with three different shading scheme (one plot per each

create two vectors X and Y of values from (-pi) to pr with a spacing of pi/10. Define the vector Z as: Z=(sin(sqrt(x^2+y^2)))/sqrt(x^2+y^2)

  Create a matlab program

Create a MATLAB program that will use MATLAB's fzero function to determine d for the following parameters: R = 0.5 m and in steps of 0.1. Create a table consisting of S and d .

  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

  Create an animation of a square

create an animation of a square according to the directions below. Create a square with a side length of 3 with the square centered at (5,5). Translate this square along a cosine wave on the interval [0, 6*pi].

  Determine the inputs, outputs, relevant formulas

determine the inputs, outputs, relevant formulas

  Using matlab and for loops

Using MATLAB and for loops, provide an animation that follows the below steps: Start with a square at the origin with each side being 5 units long. Imagine someone kicked the box and animate it moving on a projectile motion trajectory. Hint: look at ..

  Write matlab scripts

Write MATLAB scripts for to accept two numbers from the user; Display all prime numbers between these two numbers.

  Design and explain a computer-based simulation model

Design and explain a computer-based simulation model which you will use to estimate the probability that among 25, 50, 75, 100, 500, or 1000 randomly chosen people, at least 2 people share the same birthday.

  Modeling mechanical systems with matlab

MATLAB, developed by MathWorks, is a popular software that is widely used in areas of engineering, science, education and finance. Simulink is an environment for multidomain simulation and Model-Based Design for dynamic and embedded system.

  Script that will graphically show the range of frequency

the script that will graphically show the range of frequencies for which the ouput amplitude is less than 70% of the input amplitude. The original problem statement

  Find the roots using matlab built-in functions roots & fzero

the following equation, what is the modified equation for a fixed-point iteration method. The roots of the function are x = -2.2020235, -0.4088152, and 1.11083871, how would you determine whether or not the method will converge on a root? If the tech..

  Import the data into matlab and name the array ace_data

Parameter is related to the energy of the storm, since kinetic energy is proportional to velocity squared. However, it does not take into account the size of the storm, which would be necessary for a true total energy estimate.

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