Write a Matlab function which computes the integral by Simpson's rule. Your function should be used...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Matlab function which computes the integral by Simpson's rule. Your function should be used by the following command in Matlab command window: 1 >> v=Simpson (fun, a, b, n) where fun is a function handle of f(x), and a, b is the interval, and n is the number of sub-intervals (i.e., 2n+1 will be the number of points.) Test your function on problem 1. Write a script that computes, for n = 2, 4, 8, 16, 32, 128, the absolute error for each n, and a plot (with loglog) of the absolute error against n. Compute the convergence order numerically (compare the error change when n doubled). Write a Matlab function which computes the integral by Simpson's rule. Your function should be used by the following command in Matlab command window: 1 >> v=Simpson (fun, a, b, n) where fun is a function handle of f(x), and a, b is the interval, and n is the number of sub-intervals (i.e., 2n+1 will be the number of points.) Test your function on problem 1. Write a script that computes, for n = 2, 4, 8, 16, 32, 128, the absolute error for each n, and a plot (with loglog) of the absolute error against n. Compute the convergence order numerically (compare the error change when n doubled).
Expert Answer:
Answer rating: 100% (QA)
Code function v Simpsonfun a b n h b a 2 n x ahb fx funx v h 3 fx1 4 sumfx22end1 ... View the full answer
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
A Contractors Ltd was formed on 1 January 2012 and the following purchases and sales of machinery were made during the first 3 years of operations. Each machine was estimated to last 10 years and to...
-
By using Social Security Administration data for selected years from 2012 and projected to 2050, the U.S. consumer price index (CPI) can be modeled by the function C(t) = 92.7e0.0271t where t is the...
-
A double-effect evaporator (two evaporators in series) is used to produce fresh water from seawater containing 3.5 wt% dissolved salts. A flowchart for the process is shown here. Seawater enters the...
-
Write requirements for the following products and services: a. Computer. b. Airplane. c. Food Processor. d. Online Banking e. Life Insurance. f. Party Planning.
-
Farrah and Davidson had beginning capital balances of $25,000 and $20,000, respectively. The two partners fail to agree on a profit-and-loss ratio. For the first month (June 2012), the partnership...
-
A $1,000 bond with a coupon rate of 10% has a required return of 8% and 10 years to maturity. What is the current value of the bond?
-
Determine Vo and ID for the network of Fig. 2.158. Si Si
-
A window washer pulls herself upward using the bucket- pulley apparatus shown in (Figure 1). The mass of the person plus the bucket is 71 kg. Part A How hard must she pull downward to raise herself...
-
What does the owner contribute to the project and what does the contractor contribute to the project?
-
What are some of the reasons for the increased need for marketing research?
-
At what point in the project are project cost and time objectives defined for the contractor?
-
The construction process consists of numerous standardized and repetitive procedures. Why is expert guidance by a project manager necessary for a successful project?
-
What guides the formulation of a research question?
-
LKJ Company has appointed Khalid to transact in behalf of the company for a loan in Muscat Bank however the bank requested for an audit report on its financial statements for the most recent...
-
Review Exhibit 11.4. Analyze each product on the graph according to the characteristics that influence the rate of adoption. For example, what can you conclude from the data about the relative...
-
Consider the nonlinear differential equation subject to the conditions x = 3 and dx/dt = 2 at the time t = 1. Lets solve this problem using implicit Euler with a time step of h = 1/2. You may recall...
-
To test our claim about the accuracy of these methods, use Program 8.4 to calculate the integral which we know has the value I = 1 for any positive integer m. Program 8.4 We can write a nice compact...
-
Show how the error in the finite difference approximation depends on the number of nodes n for the reactiondiffusion equation. with c(0) = 0 and c(1) = 1. In chemical engineering lingo, the quantity ...
-
Problem Decide whether the sampling method is independent or dependent. Then determine whether the response variable is qualitative or quantitative. (a) Joliet Junior College decided to implement a...
-
Using the data from Table 2, construct a \(95 \%\) confidence interval estimate of the mean difference, \(\mu_{d}\). By Hand Approach Step 1 Compute the differenced data. Because the sample size is...
-
In the Spacelab Life Sciences 2 payload, 14 male rats were sent to space. Upon their return, the red blood cell mass (in milliliters) of the rats was determined. A control group of 14 male rats was...
Study smarter with the SolutionInn App