Computer Science, asked by darkkhnight1100, 3 months ago

Write a MATLAB program to find the solution of the given equation using the Simpson 1/3rd and Simpson 3/8th rule:
\int\limits^5_{-2} {\sqrt{x^{2} + 1} } \
Take the step size/spacing to be h=1

Answers

Answered by sanjaykamble3330666
1

Answer:

I don't know

Explanation:

.

mark me as brainliest ☺️

give me some thanks

Answered by nikhilrajgone2008
3

Answer:

RES = SIMPSON(Y) computes an approximation of the integral of Y via

Simpson's 1/3 rule (with unit spacing). Simpson's 1/3 rule uses

quadratic interpolants for numerical integration. To compute the

integral for spacing different from one, multiply RES by the spacing

increment.

For vectors, SIMPSON(Y) is the integral of Y. For matrices, SIMPSON(Y)

is a row vector with the integral over each column. For N-D

arrays, SIMPSON(Y) works across the first non-singleton dimension.

RES = SIMPSON(X,Y) computes the integral of Y with respect to X using

Simpson's 1/3 rule. X and Y must be vectors of the same

length, or X must be a column vector and Y an array whose first

non-singleton dimension is length(X). SIMPSON operates along this

dimension. Note that X must be equally spaced for proper execution of

the 1/3 and 3/8 rules. If X is not equally spaced, the trapezoid rule

(MATLAB's TRAPZ) is recommended.

RES = SIMPSON(X,Y,DIM) or SIMPSON(Y,DIM) integrates across dimension

DIM of Y. The length of X must be the same as size(Y,DIM)).

RES = SIMPSON(X,Y,DIM,RULE) can be used to toggle between Simpson's 1/3

rule and Simpson's 3/8 rule. Simpson's 3/8 rule uses cubic interpolants

to accomplish the numerical integration. If the default value for DIM

is desired, assign an empty matrix.

- RULE options

[DEFAULT] '1/3' Simpson's rule for quadratic interpolants

'3/8' Simpson's rule for cubic interpolants

Examples:

% Integrate Y = SIN(X)

x = 0:0.2:pi;

y = sin(x);

a = sum(y)*0.2; % Rectangle rule

b = trapz(x,y); % Trapezoid rule

c = simpson(x,y,[],'1/3'); % Simpson's 1/3 rule

d = simpson(x,y,[],'3/8'); % Simpson's 3/8 rule

e = cos(x(1))-cos(x(end)); % Actual integral

fprintf('Rectangle Rule: %.15f\n', a)

fprintf('Trapezoid Rule: %.15f\n', b)

fprintf('Simpson''s 1/3 Rule: %.15f\n', c)

fprintf('Simpson''s 3/8 Rule: %.15f\n', d)

fprintf('Actual Integral: %.15f\n', e)

Explanation:

please give thank and please mark as brilliant

Similar questions