Write a matlab program that receives as input a number x

Assignment Help Basic Computer Science
Reference no: EM131263657

Write a MATLAB program that receives as input a number x and a parameter n and returns x rounded to n decimal digits. Write your program so that it can handle an array as input, returning an array of the same size in this case. Use your program to generate numbers for Example 2.2, demonstrating the phenomenon depicted there without use of single precision.

Example 2.2

We evaluate g(t) = e-t (sin(2πt)+2) at 501 equidistant points between 0 and 1, using the usual double precision as well as single precision and plotting the differences. This essentially gives the rounding error in the less accurate single precision evaluations. The following MATLAB instructions do the job:

2176_20cab1ae-9d39-4c64-90dd-cffbe4802705.png

Reference no: EM131263657

Questions Cloud

Firm produce at the equilibrium price : This firm operates in a perfectly competitive industry with market demand and supply curves given by Qd = 100 - 8P and QS = -20 + 2P, where Q is measured in millions of units. Based on the figure, how many units of output will the firm produce at ..
Develop your own project in order to test a hypothesis : In this assignment, you will develop your own project in order to test a hypothesis of your interest. Follow the following steps to do that: You will collect data on GPA for a particular department at the university
Travel time each way price of a skirt local department : Juanita is deciding whether to buy a skirt that she wants, as well as where to buy it. Three stores carry the same skirt, but it is more convenient for Juanita to get to some stores than others. For example, she can go to her local store, located ..
Compare and contrast holism versus reductionism : The paper will be five pages: (a) Describe Holism - 2 pages, (b) Describe Reductionism - 2 pages, (c) Compare and contrast Holism versus Reductionism - 1 page.
Write a matlab program that receives as input a number x : Write your program so that it can handle an array as input, returning an array of the same size in this case. Use your program to generate numbers for Example 2.2, demonstrating the phenomenon depicted there without use of single precision.
Determining the quantity of the product : Suppose that the long-run total cost curve for each firm is given by TC = 500Q - 20Q2 + Q3, where Q is the quantity of the product. Also suppose there is free entry and exit. To find the quantity where ATC is minimized, the firm would need to solv..
Normal and inferior goods : (a) Answer True or False to the following and provide a justification for your choice. (i) The price of a good X rises, causing the demand for good Y to fall. Thetwo goods are therefore substitutes.
Explain the storage scheme for single precision : The fraction in a single precision word has 23 bits (alas, less than half the length of the double precision word). Show that the corresponding rounding unit is approximately 6×10-8.
Income effect and substitution effect of the price change : a. What are the income effect and substitution effect of the price change? b. Are scallops a normal good or an inferior good? c. Is beef jerky a normal good or an inferior good?

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  What heading do the list of previously saved files appear

Sometimes, we may need to work with presentations that were created in earlier versions of Microsoft PowerPoint, such as PowerPoint 2003 or PowerPoint 2000. When we open these kinds of presentations, they will appear in

  Holding ten elements of data

Begin this program by creating two arrays of integers, each holding ten elements of data. Create a third array of integers for a result array. Your main program will take the two arrays of integers and pass them to the function subtract(). Inside ..

  Determine the types of organizations

Analyze the major ways that cryptography can help alleviate risks that exist when using cloud computing. Determine the types of organizations that would benefit the most from enabling cryptography while using cloud computing. Provide a rationale f..

  Determine the radius of the friction circle

If the piston is moving downwards, and the coefficient of static friction at the contact points is µs = 0.2, determine the radius of the friction circle at each connection.

  What is the expected number of floors the elevator stops

A building has n floors numbered 1, 2, . . . , n, plus a ground floor G.

  How good is this analogy

Suppose we argue that the toolbox, the truck, and the shop correspond to the L1 cache, the L2 cache, and the main memory of a computer. How good is this analogy? Discuss its correct and incorrect features.

  Automobile customers are billed

Suppose automobile customers are billed at the rate of $35 per hour for labor. Also, costs for parts and supplies are subject to a 5% sales tax. Write a program to print out a simplified bill.

  The motherboard is a volatile or non-volatile storage

The motherboard is a volatile or non-volatile storage unit and what does in control?

  Compute storage in bytes which is needed for frame buffer

If we want to store 6 bits per pixel in frame buffer, how much storage (in bytes) do we need for the frame buffer?

  Factoring is the problem of computing

Consider the one time pad encryption scheme to encrypt a 1-bit message. Replace the XOR operation with another operation X. For which X does the resulting scheme satisfy perfect secrecy?

  How long was a bit in the original 802.3 standard in meters

How long was a bit in the original 802.3 standard in meters?

  The five essential elements of an enforceable contract

Critical Analysis Paper. Give an example of a contract that you or someone you know entered into (for example, rental agreement, cell phone agreement, property purchase or lease-car, home, furniture, etc.

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