Numerical Integration with integral Integration is one of two main operations of calculus. If you aren't familiar with it or do not recall much about it, you can think of it as simply a way to calculate the "area under the curve". Calculates the area from a given starting point to a given end point Built in function in MATLAB - integral(fun, xmin, xmax) fun is a function handle to the function you want to integrate (find area under) Can use an anonymous function to make this easy Note: fun must use elementwise operations xmin is the start of the region we are integrating over xmax is the end of the region we are integrating over Note that xmin can take the value -Inf (negative infinity) and xmax can take the value Inf (positive infinity) to calculate improper integrals Create y1 and y2 and plot them. Example 1: find area under y1 between 1 and 4 Example 2: find area between curves (where y2 >= y1) Find where they intersect using fzero (to set xmin and xmax) Find area between by taking the difference -> area under top curve - area under bottom curve Example 3: find b such that the area under y2 between 0 and b is equal to 30 Define a function that calculates area under curve from 0 to b To find (area 0 to b) = 30, can use fzero to calculate (area 0 to b) - 30 = 0 Plot this function so we can find a starting guess Need to use a for loop to calculate, integral can't take a vector as input Pass function to fzero to calculate