Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;

image text in transcribedPlease 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

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions

Question

Recognize your typical method of resolving conflict.

Answered: 1 week ago

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago