// // Chris Hough // // Final Program 2 - Write a scilab program to do the same as Program 1. // September 15, 2003 // // //define the function function foo=f(x) foo=5*x+((sin(9*x-5))/x); endfunction //set the time length steps = 100; x_start = 1; x_end = 10; x_delta = (x_end - x_start)/steps; //trapezoidal integration loop // total = 0; for i=0:steps-1, x = x_start + i * x_delta; if i == 0 then total = total + f(x); elseif i == steps then total = total + f(x); else total = total + 2*f(x); end end total = total * x_delta/2; printf("The inigration value is %f\n",total);