clc; clear; a=input('Escribe el valor de (a) la integral\n'); b=input('Escribe el valor de (b) la integral\n'); n=input('Escribe la cantidad de veces que se va a repetir la acción de este método para la aproximación de la integral\n'); x=(1:n+1); fx=(1:n+1); fk=0; fkk=0; if ((-1)^n)==1 h=(b-a)/n; for i=1:n+1 x(i)=a+((i-1)*h); fx(i)=sqrt(1+x(i)); end for k=1:(((n-2)/2)+1) fk=fk+fx((2*k)+1); end fk=fk*4; for k=1:(((n-2)/2)+1) fkk=fkk+fx((2*k)+1); end fkk=fkk*2; A=(h/3)*(fx(1)+fx(n+1)+fk+fkk); disp('\n\nvalor de la integral=') disp(A) else disp('\nLa secuencia de repeticion debe ser par'); end