find the volume of the surface of revolution created by revolving the region bounded by the equations y=2*tan(x) and y=sec(x)-1 between x=0 and x= 4 about the x-axis in matlab

To find the volume of the surface of revolution created by revolving the region bounded by the equations y=2*tan(x) and y=sec(x)-1 between x=0 and x= 4 about the x-axis in MATLAB, we need to use the formula of surface area of revolution and integrate it.

The formula for the surface area of revolution is given by:

S = 2*pi*int(b-a)[f(x)*sqrt(1+(dy/dx)^2)]dx

In our case, the equation for the surface is given by y=f(x). So, we need to calculate S by integrating this equation with respect to x.

Here's the MATLAB code to find the volume:

main.m
syms x;

% Define the functions f(x), g(x) and the limits of integration
f = 2*tan(x);
g = sec(x)-1;
a = 0;
b = 4;

% Calculate surface area using formula
S = 2*pi*int(f*sqrt(1+diff(f,x)^2),x,a,b) - 2*pi*int(g*sqrt(1+diff(g,x)^2),x,a,b);

% Calculate volume by integrating surface area 
V = pi*int(S^2,x,a,b);

% Display the volume
disp(V);
341 chars
17 lines

This code first defines the functions f(x) and g(x), and the limits of integration a=0 and b=4. Then, it calculates the surface area S using the formula and integrates it to find the volume V. Finally, it displays the volume.

Note that the syms command is used to define x as a symbolic variable, so that MATLAB can perform symbolic integration.

The output of this code will be the value of the volume of the surface of revolution.

related categories

gistlibby LogSnag