Question: Please use this code below as a template to help you and solve asap thanks close all; clearvars; clc; %define integration method sel_meth = -1;

Please use this code below as a template to help you andPlease use this code below as a template to help you and solve asap thanks

close all; clearvars; clc;

%define integration method

sel_meth = -1;

disp('Integration Method:');

disp('1) Rectangular, 2) Trapezium, 3) Simpsons 4) Gaussian');

%ensure that correct number is provided

while (sel_meth~=1 && sel_meth~=2 && sel_meth ~=3 && sel_meth ~=4 )

sel_meth = input('Please Select integration method: 1,2,3 or 4 ');

end

N = -1;

disp('Set Number of intervals in x direction, or of Gauss points:');

while (N max unsigned 8-bit integer : 255)

N = input('Please provide a positive integer ');

end

M = -1;

disp('Set Number of intervals in y direction, or of Gauss points:');

while (M

M = input('Please provide a positive integer ');

end

x_min=inf; y_min=inf;

disp('Set the lower limits for integration:');

while (isinf(x_min) && isnumeric(x_min))

x_min = input('In the x direction: ');

end

while (isinf(y_min) && isnumeric(y_min))

y_min = input('In the y direction: ');

end

x_max=-inf; y_max=-inf;

disp('Set the upper limits for integration:');

while (isinf(x_max) && isnumeric(x_max) && (x_max

x_max = input('In the x direction: ');

end

while (isinf(y_max) && isnumeric(y_max) && (y_max

y_max = input('In the y direction: ');

end

%x_min=-1; x_max=0; y_min=0; y_max=2;

switch sel_meth

case 1

INTEGRAL=Rect_2D_tut_analytic(@fun1,x_min,x_max,y_min,y_max,N,M);

METHOD= 'Rectangle';

case 2

INTEGRAL=Trap_2D_tut_analytic(@fun1,x_min,x_max,y_min,y_max,N,M);

METHOD = 'Trapezium';

case 3

INTEGRAL=simp_2D_tut_analytic(@fun1,x_min,x_max,y_min,y_max,N,M);

METHOD = 'Simpsons';

case 4

INTEGRAL=Gauss_2D_tut_analytic(@fun1,x_min,x_max,y_min,y_max,N,M);

METHOD = 'Gauss';

end

3) Using Integrate_analytic_function_2D.m (Tutorial 10) as a template, code adaptive refinement for the Rectangle, Trapezium and Simpson's Rules, where the number of intervals in x and y directions are progressively increased from 8 to 80 in steps of 2. The following types of refinement should be implemented for each rule: a. Only increase the number of intervals in the x direction in steps of 2, leaving the number of intervals in the y direction constant at 8. b. Only increase the number of intervals in the y direction in steps of 2, leaving the number of intervals in the x direction constant at 8 . c. Simultaneously increase the number of intervals in the x and y direction from 8 to 80 in steps of 2. Show your Matlab code. [4 Marks] 4) Make one figure for each rule where you show how the solution changes with progressive refinement by plotting the number of intervals vs the values of the integral. The three types of refinement (a,b and c) must be shown clearly in each plot

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!