To calculate the indefinite antiderivative (i.e. integration) of a function in Matlab, you can use the "int" function from the Symbolic Math Toolbox. Here's an example of how to use it:
main.m157 chars4 lines
The resulting antiderivative F will also be a symbolic expression, which you can evaluate at specific values of x using the "subs" function. Alternatively, you can use the "diff" function to verify that F is indeed the antiderivative of f:
main.m34 chars2 lines
gistlibby LogSnag