find the area bounded by the curves fx=9-x2 and gx=x-3 in matlab

First, let's plot the curves to see the bounded region:

main.m
x = linspace(-4, 4, 100);   % Define x-axis range
fx = 9 - x.^2;              % Define f(x)
gx = x - 3;                 % Define g(x)
plot(x, fx, x, gx)          % Plot f(x) and g(x)
183 chars
5 lines

Now, we can see that the bounded region is the area under f(x) minus the area under g(x), between the intersection points (-3, 0) and (3, 0):

main.m
syms x                     % Define symbolic variable x
A = int(9-x^2, x, -3, 3) - int(x-3, x, -3, 3)   % Calculate area
121 chars
3 lines

This should give us the value of 36. So the area bounded by the curves f(x) = 9 - x^2 and g(x) = x - 3 is 36 square units.

Note that we used the symbolic variable x to perform the integration calculations, and the int function to perform the integration from -3 to 3 for both curves.

related categories

gistlibby LogSnag