# 19BMA0013_VL2019201004553_AST02.pdf - AREA VOLUME OF SOLID...

• 11

This preview shows page 1 - 4 out of 11 pages.

AREA, VOLUME OF SOLID REVOLUTION clear all clc syms x f=input( 'Enter the upper curve f(x): ' ); g=input( 'Enter the lower curve g(x): ' ); L=input( 'Enter the limits of integration for x [a,b]:' ); a=L(1); b=L(2); Area=int(f-g,x,a,b); disp([ "Area bounded by the curves f(x) and g(x) is: " ,char(Area)]); x1=linspace(a,b,20);y1=subs(f,x,x1); x2=x1;y2=subs(g,x,x1); plot(x1,y1); hold on ; plot(x2,y2); hold off ; xlabel( 'x-axis' ); ylabel( 'y-axis' ); legend( 'f(x)' , 'g(x)' ); grid on ; Enter the upper curve f(x): 2-x^2 Enter the lower curve g(x): -x Enter the limits of integration for x [a,b]:[-1,2] "Area bounded by the curves f(x) and g(x) is: " "9/2"
clear all clc syms y f=input( 'Enter the right curve f(y): ' ); g=input( 'Enter the left curve g(y): ' ); L=input( 'Enter the limits of integration for y [c,d]:' ); c=L(1); d=L(2); Area=int(f-g,y,c,d); disp([ 'Area bounded by the curves f(y) and g(y) is: ' ,char(Area)]); y1=linspace(c,d,20);x1=subs(f,y,y1); y2=y1;x2=subs(g,y,y1); plot(x1,y1); hold on ; plot(x2,y2); hold off ; xlabel( 'x-axis' ); ylabel( 'y-axis' ); legend( 'f(y)' , 'g(y)' ); grid on ; Enter the right curve f(y): 2+y Enter the left curve g(y): y^2 Enter the limits of integration for y [c,d]:[0,2] Area bounded by the curves f(y) and g(y) is: 10/3
clc syms x f=input( 'Enter the function f(x): ' ); c=input( 'Enter the axis of rotation y = c (enter only c value): ' ); iL=input( 'Enter the integration limits: ' ); a=iL(1);b=iL(2); vol=pi*int((f-c)^2,a,b); disp([ 'Volume of solid of revolution is: ' ,char(vol)]); x1=linspace(a,b,20); y1=subs(f,x,x1); x2=x1; y2=c*ones(length(x1)); plot(x1,y1); hold on ; plot(x2,y2); hold off ; xlabel( 'x-axis' ); ylabel( 'y-axis' ) legend( 'The curve y=f(x)' ,