Write a MATLAB or Java C C implementation that finds the int

Write a MATLAB (or Java, C, C++) implementation that finds the integral of the Newton\'s (or Lagrange\'s) polynomial constructed above, over the interval [0:10] by (composite) Trapezoidal rule: The implementation should take the number of subintervals N as an input. It should find the true value of the integral and compare it with the approximate value derived by Trapezoidal rule. Note that you need to report the mathematical procedure as well.

Solution

Answer:

Using MATLAB

clc;
clear all;
close all;

f=(x)1/(1+x); %Change here for different function
a=0;b=10; %Given limits
n=b-a; %Number of intervals
h=(b-a)/n;
p=0;

for i=a:b
p=p+1;
x(p)=i;
y(p)=1/(1+i); %Change here for different function
end


 Write a MATLAB (or Java, C, C++) implementation that finds the integral of the Newton\'s (or Lagrange\'s) polynomial constructed above, over the interval [0:10

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site