Department of Computing MATH 333: Numerical Analysis Class: BSCS-9ABC Lab 13: Numerical Integration Date: May 2nd, 2023 Time: 10:00 - 1:00 Lab Engineer: Anum Asif Name: Hassan Haroon CMS: 339817 Lab 13: Numerical Integration Introduction Matlab represents polynomials with a vector of coefficients. The length of the vector will always be one more than the order of the polynomial Objectives The purpose of this lab is to get familiar with Numerical Integration. Tools/Software Requirement Matlab Description Need of Numerical Integration: For evaluating the definite integral of a function that has no explicit anti-derivatives or whose anti-derivatives is not easy to obtain. Lab Task: 1. Output: Code: % Data Points x_values = 0:2:20; y_values = [0 16 29 40 46 51 32 18 8 3 0]; % Interval interval = x_values(2) - x_values(1); % Get the number of components num_components = length(x_values); simpson_1_3rd = 0; % Loop through each set and apply Simpson's 1/3rd rule for i = 1:2:num_components-2 simpson_1_3rd = simpson_1_3rd + (interval/3) * (y_values(i+2) + 4*y_values(i+1) + y_values(i)); end disp(['The result obtained using Simpson''s 1/3rd rule is: ', num2str(simpson_1_3rd)]) 2. Suppose that the upward force of air resistance on a falling object is proportional to the square of the velocity. For this case velocity can be computed as 𝑣(𝑡) = √ 𝑔𝑚 𝑔𝑐𝑑 tanh (√ 𝑡) 𝑐𝑑 𝑚 Where 𝑐𝑑 = a second-order drag coefficient. If = 9.8 𝑚/𝑠 2 , 𝑚 = 68.1 𝑘𝑔 and 𝑐𝑑 = 0.25𝑘𝑔/𝑚, use trapezoidal rule to determine how far the object falls in 10𝑠. Use a sufficiently high 𝑛 that you get eight significant digits of accuracy. Output: Code: % Initialize gravity, mass, and drag coefficient gravity = 9.8; mass = 68.1; drag_coefficient = 0.25; % Start time time_start = 0; % End time time_end = 10; % Number of intervals num_intervals = 1000000; % Calculate the interval size interval_size = (time_end - time_start) / num_intervals; % Function for velocity velocity = @(t) sqrt((gravity * mass / drag_coefficient)) * tanh(sqrt((gravity * drag_coefficient) / mass) * t); % Initialize distance distance = 0; % Apply Trapezoidal rule for i = 1:num_intervals t1 = time_start + (i-1) * interval_size; t2 = time_start + i * interval_size; distance = distance + interval_size / 2 * (velocity(t1) + velocity(t2)); end % Display the result disp(['The distance fallen in 10 seconds is: ', num2str(distance), ' meters']); Deliverables Submit single word file with matlab code and screen shot of Output.