Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Matlab code to integrate a function that is approximated using a uniformly spaced array of points. The function should have the form function

image text in transcribedWrite a Matlab code to integrate a function that is approximated using a uniformly spaced array of points. The function should have the form function [integral] = integrate(h,values) Use the Simpsons 1/3 rule for the integration. Again use a regularly spaced array of node locations with a node at both x = 0 and x = 1 generated using the linspace command as was done in the previous problem. For this assignment, you will again do this 4 times with N = 3, 5, 9, 17 so you can see how the approximation changes as the number of points increases (h decreasing by a factor of 2). Integrate the function sin(x) (not 2 this time). Calculate the absolute error in integral as a function of N. Make a loglog plot of the error versus N for N = 3, 5, 9, 17.

Write a Matlab code to integrate a function that is approximated using a uniformly spaced array of points. The function should have the form function [integral]-integrate (h,values) Use the Simpson's 1/3 rule for the integration. Again use a regularly spaced array of node locations with a node at both 2-0 and 1 generated using the problem. For this assignment, you will again do this 4 times with N- 3,5,9, 17 so you can see how the approximation changes as the number of points increases (h decreasing by a factor of 2). Integrate the function sin(TI) (not 2 this time). Calculate the absolute error in integral as a function of N. Make a loglog plot of the error versus N for N- 3,5,9, 17

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

More Books

Students also viewed these Databases questions

Question

1. How do most insects respire ?

Answered: 1 week ago