Numerical integration: Difference between revisions

Content added Content deleted
m (I have added the link which can guide more to the readers about what Matlab Tutorials)
Line 3,569: Line 3,569:
{18000003., 18000009., 18000006., 18000000., 18000000.}}</pre>
{18000003., 18000009., 18000006., 18000000., 18000000.}}</pre>


=={{header|MATLAB}} / {{header|Octave}}==
=={{header|[MATLAB]}} / {{header|Octave}}==


For all of the examples given, the function that is passed to the method as parameter f is a function handle.
For all of the examples given, the function that is passed to the method as parameter f is a function handle.
Line 3,612: Line 3,612:
end</lang>
end</lang>


Simpson's rule for numerical integration is already included in MATLAB as "quad()". It is not the same as the above examples, instead of specifying the amount of points to divide the x-axis into, the programmer passes the acceptable error tolerance for the calculation (parameter "tol").
Simpson's rule for numerical integration is already included in [http://www.entechin.com/linspace-matlab-tutorial-syntax-examples/ Matlab] as "quad()". It is not the same as the above examples, instead of specifying the amount of points to divide the x-axis into, the programmer passes the acceptable error tolerance for the calculation (parameter "tol").
<lang MATLAB>integral = quad(f,a,b,tol)</lang>
<lang MATLAB>integral = quad(f,a,b,tol)</lang>