Blame view

lab1/pi_matlab.m 142 Bytes
6a98a5afa   kmazouzi   lab1
1
2
3
4
5
6
7
8
9
10
11
12
13
  
  function pi = Pi_matlab( n )
  
  h = 1.0/n;
  pi = 0.0;
  
  for i=1:n
    x = (i + 0.5)*h;
    pi = pi+ (4.0/(1.0 + x*x));
    end
   pi=pi*h;
   disp(pi)
  end