SHARE
TWEET

Untitled

a guest Aug 12th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main()
  2.     xmin = input('xmin = ');
  3.     xmax = input('xmax = ');
  4.  
  5.     fun = @(x) 5 * (exp(1) ^ -((x - 3)^2));
  6.     area = riemann(fun, xmin, xmax);
  7.  
  8.     area
  9. end
  10.  
  11. function y = riemann(f, xmin, xmax)
  12.     delta = 0.0001;
  13.  
  14.     y = 0;
  15.  
  16.     for t=xmin:delta:xmax
  17.         y = y + delta * f(t);
  18.     end
  19. end
RAW Paste Data
Top