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 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started