Write MATLAB code to modify the previous gravity calculation examples as follows (see below for original...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write MATLAB code to modify the previous gravity calculation examples as follows (see below for original prompt): If the user enters a zero value for mass, an error message will be generated and the program will terminate; if the user enters a negative value for mass, the program will issue an appropriate warning message and calculate the gravity by using the absolute value of the mass; for strictly positive masses, the program will calculate gravity in the normal manner. Original Prompt: We are given the weight (in variable w) in newtons of an object as well as the mass (in variable m) in kilograms and want to determine the gravity in meters per second squared. To solve this, we will use the equation g = w/m, but we want to wrap that expression inside a conditional just in case the user provides a zero mass, which does not make sense in our situation, but will not cause an error in MATLAB-if you divide a number by 0 in MATLAB, the value "Inf" is calculated, which represents infinity. Write MATLAB code to modify the previous gravity calculation examples as follows (see below for original prompt): If the user enters a zero value for mass, an error message will be generated and the program will terminate; if the user enters a negative value for mass, the program will issue an appropriate warning message and calculate the gravity by using the absolute value of the mass; for strictly positive masses, the program will calculate gravity in the normal manner. Original Prompt: We are given the weight (in variable w) in newtons of an object as well as the mass (in variable m) in kilograms and want to determine the gravity in meters per second squared. To solve this, we will use the equation g = w/m, but we want to wrap that expression inside a conditional just in case the user provides a zero mass, which does not make sense in our situation, but will not cause an error in MATLAB-if you divide a number by 0 in MATLAB, the value "Inf" is calculated, which represents infinity.
Expert Answer:
Answer rating: 100% (QA)
Matlab function g gravityw m This function calculates the gravity g in meters per second squared for an object with weight w in newtons and mass m in ... View the full answer
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Explain whether each of the following events represents (i) a shi of the supply curve or (ii) a movement along the supply curve. a. More homeowners put their houses up for sale during a real estate...
-
List the ten managerial roles based on their three categories.
-
The company makes colorful 100% cotton shirts that are very popular among sophisticated business executives. The company uses 50,000 pounds of cotton each month in its production process. On December...
-
A long solenoid with 300 windings per meter of length carries a current of \(1.0 \mathrm{~A}\). Calculate the magnitude of the magnetic field inside the solenoid.
-
Mott Company recently implemented a JIT manufacturing system. After one year of operation, Heidi Burrows, president of the company, wanted to compare product cost under the JIT system with product...
-
How do you print the first value in a tuple called aVar?
-
I farm on a small scale. Last year, I started off by planting soybeans and corn. This year, the price of soybeans increased, and the price of corn remained the same. Naturally, I planted more corn...
-
For the given beam, calculate the slope and deflection at point B by Castigliano Method. You can take modulus of elasticity (E) and moment of inertia (1) values as your own values. Choose a material...
-
Discuss the primary information system technologies likely to be used to support social media sites. Include a description of how the technology is used. Identify an ethical issue that might occur...
-
Given the vectors a = (1, 1, 5) 2 18 and find 6 = (3, 2,4)
-
One of the engineers on your staff has an excellent job offer from another company and asks your advice about whether or not to accept the position. You need him to complete a project that is crucial...
-
Allen has a craft store called Pentcrafto, where she sells home decor products made from recycled paper. In the context of marketing, what utilities are Pentcrafto's products most likely to provide?...
-
Netflix Organizational Change & Structure Case Study _________________________________________________________ GENERAL INSTRUCTIONS: Please make sure to write your name , student id and entire course...
-
a) Audit and assurance services are 1) independent professional services that 2) dependent professional service that 3) not helpful to b) improve the quality of information for decision makers....
-
Write the expression in radical notation. Then evaluate the expression when the result is an integer. 23 -1/2
-
What are the two types of systems auditors?
-
What is an appropriate placement of controversial questions?
-
List the four categories into which classes fall.
-
Scuba divers are warned that if they must make a rapid ascent, they should exhale on the way up. If a diver rapidly ascends to the surface with lungs full of air, his lungs could be damaged. Explain...
-
Early airshipscraft that relied on large volumes of low density gas to rise from the groundwere filled with hydrogen, but safety concerns necessitated a switch to helium. When an airship made the...
-
Freshwater fish tend to have larger swim bladders than saltwater fish. Explain why you would expect this to be true.
Study smarter with the SolutionInn App