I want to write a section of code that calculates the surface area of a sphere by solving the integral form. The ultimate goal is to change the limits of integration to find sections of the area. Problem is that the value of 'S' I'm getting is way off. Thanks for the help!
R = 1;
theta_1 = 0;
theta_2 = pi;
fun = @(theta) -cos(theta);
S = 4*pi*R^2*(integral(fun,theta_1,theta_2));