Develop a Matlab code to perform numerical integration for t
Develop a Matlab code to perform numerical integration for the following data using trapezodal rule. Matlab code MUST BE BASED ON Pseudocode provided below.
| x | 0 | 0.5 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| f(x) | 0.5 | 3.2 | 5.1 | 9.8 | 10.3 | 9.4 | 8.7 | 6.6 | 5.4 | 
Solution
x = [0, 0.5, 2, 3, 4,5,6,7,8]
 y = [0.5, 3.2, 5.1, 9.8, 10.3, 9.4, 8.7, 6.6, 5.4]
 n = 9
function sum = Trapun(x, y, n)
 %This function perform numerical integration
 % using trapezodal rule
 sum = n;
 for i = 2:n
    sum = sum + (x(i)- x(i-1))*(y(i)+ y(i-1))/2;
 end
end
sum1 = Trapun(x, y, n)

