Question

1) Numerical Integration There are many simply written functions which have no simple closed form antiderivative. These funct
i need the coding in matlab
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.TRAPEZOIDAL METHOD
clear all
f=@(x)1/(1+x);
n=input('enter the number of pertitions');
s=f(0)+f(1);
h=1/n;
for i=1:1:n-1
s=s+2*f(i*h);
end
t=(h*s)/2

2.SIMPSON METHOD
clear all
f=@(x,y) y-x^2+1;
a=input('enter the left end point of the closed interval: ');
b=input('enter the right end point of the closed interval: ');
y(1)=input('enter the value of y at a: ');
n=input('enter the number of intervals: ');
h=(b-a)/n;
for i=1:n+1
y(i+1)=y(i)+h*f(a+i*h,y(i));
end
y'

Add a comment
Know the answer?
Add Answer to:
i need the coding in matlab 1) Numerical Integration There are many simply written functions which...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Simpson's rule. Simpson's rule is a different formula for numerical integration of lºf (d.x which...

    1. Simpson's rule. Simpson's rule is a different formula for numerical integration of lºf (d.x which is based on approximating f(2) with a piecewise quadratic function. We will now derive Simpson's rule and relate it to Romberg integration: a. Suppose that (2) is a quadratic polynomial so that q(-h) = f(-h), q0) = f(0) and q(h) = f(h). Prove that 92 f(-h) + 4f(0) + f(h)). -h b. Suppose that the interval [a, b] is divided by a = 20,...

  • Written Essay on Module 4: Applications of Integration & Numerical Integration, Due May 2 5. (10...

    Written Essay on Module 4: Applications of Integration & Numerical Integration, Due May 2 5. (10 points) For both graphs below, use (i) Trapezoidal Rule, and (ii) Simpson's Rule with a sub- division into n = 4 subintervals to estimate the area under the given curves on the interval (1,5). (iii) In each case, determine which rule is more accurate. Explain why. (a) y = f(x) (b) y = g(x)

  • 1. Numerical Integration The integral of a function f(x) for a s x S b can be interpreted as the ...

    1. Numerical Integration The integral of a function f(x) for a s x S b can be interpreted as the area between the f(x) curve and the x axis, bounded by the limits x- a and x b. If we denote this area by A, then we can write A as A-f(x)dx A sophisticated method to find the area under a curve is to split the area into trapezoidal elements. Each trapezoid is called a panel. 1.2 0.2 1.2 13...

  • Use Matlab code Consider the following function sin(x) Using the following parameters in your functions: -func:...

    Use Matlab code Consider the following function sin(x) Using the following parameters in your functions: -func: the function/equation that you are required to integrate -a, b: the integration limits n: the number of points to be used for the integration I:Integral estimate a) Write a function capable of performing numerical integration of h(x) using the composite trapezoidal rule. Use your function to integration the equation with 9 points. Write a function capable of performing numerical integration of h(x) using the...

  • please answer question 5. question 4 is provided for reference. Problem 5: Application of composite integration...

    please answer question 5. question 4 is provided for reference. Problem 5: Application of composite integration rules Assume that you want to approximate the integral of a function in [0, 21 and have only the values of f on specific x values, given in the following table. x005 11.5| 2 (a) Find an approximation to f(x) dx using the composite trapezoid integration rule. Specify all parameters of the approximation and carry out the calculation completely. Assignment 8 MATH363, Spring 2019...

  • Programming Assignment - Numerical Integration In MATH 1775 last semester, you used Riemann sums in Excel...

    Programming Assignment - Numerical Integration In MATH 1775 last semester, you used Riemann sums in Excel to approximate the value of the definite integral that represents the area of the region between the x-axis and the graph of 2 5 y xx = − 8 shown below. The purpose of this assignment is to increase the accuracy of such approximations of integrals. Write a program (using java) that uses the Midpoint Rule, the Trapezoid Rule, and Simpson’s Rule to find...

  • These instructions are written with the assumption that code will be done in matlab. You might fi...

    These instructions are written with the assumption that code will be done in matlab. You might find the following built in commands useful: length, plot, xlabel, ylabel, title, legend, fzero, plot, disp, axis, axes, min, max. 2. Numerical Integration (Quadrature). Write FOUR of your own numerical integration routines. One should use left-end, right-end, or mid-points, another should use the trapezoid method, another should use Simpson’s method, and the fourth should use either Guassian Quadrature or Romberg’s method. Use your four...

  • MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demo...

    MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demonstrates using instructor-provided and randomized inputs to assess a function problem. Custom numerical tolerances are used to assess the output. Simpson's Rule approximates the definite integral of a function f(x) on the interval a,a according to the following formula + f (ati) This approximation is in general more accurate than the trapezoidal rule, which itself is more accurate than the leftright-hand rules. The increased...

  • Please answer #2. y llese data. Use Simpson's 1/3 rule.. he variation of pressure with volume....

    Please answer #2. y llese data. Use Simpson's 1/3 rule.. he variation of pressure with volume. 5.18 The following data were provided for the variation of pressu V, in 13.0 11.0 9.0 70 P, lb/in? V, in 1125.0 131 3.0 157 2.0 197 1.0 P, lb/in? 270 424 500 525 Given that work = ſ PDV, calculate the work performed in this process in ft-lb by integrating these data by hand. Use Simpson's rule(s). 1. Consider the following is integral...

  • need help finishing this problem. matlab erf(x) = 2-1 e_pdt Vr Joe Composte trapezoid rule (MATLAB trapz andlor cu...

    need help finishing this problem. matlab erf(x) = 2-1 e_pdt Vr Joe Composte trapezoid rule (MATLAB trapz andlor cuntrapr tunctions) Three point Gauss-Legendre quadrature MATLAB's builb-in integral function (Adaptive Gauss-Kronrod Quadrature) Write a function that receives the following single input 1. A column vector of one or more values at which el) is to be computed Your function should reburn the following outputs (in order, column vectors when input is a vector) 1. The estimate(s) for ert) caculated using composite...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT