Calculus (2).pdf - CALCULUS FOR ENGINEERS MATLAB SUBMITTED...

• 27

This preview shows page 1 - 7 out of 27 pages.

CALCULUS FOR ENGINEERS MATLAB SUBMITTED TO: PROF.CHANDRASEKARAN V.M. SUBMITTED BY:HARISH.K REGISTER NO:18BEC0353
EXPERIMENT NO: 3-A Applications of Integrals: Finding area, volume of solid of revolution. CLASS WORK PROBLEMS: EXAMPLE 1: The area bounded by the curves y=2-x^2 and the line y=-x, from x=-1 to 2. 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 ; INPUT: 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] OUTPUT: Area bounded by the curves f(x) and g(x) is:9/2
EXAMPLE-2: To find the area of the region bounded by the curves y^2=x,y=x-2 in the first quadrant .Here the right curve is the straight line x=2+y, the left curve is x=y^2.The limits of integration being y=0 to 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 ; INPUT: 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] OUTPUT: Area bounded by the curves f(y) and g(y) is 10/3
EXAMPLE-3: The volume of the solid generated by the revolving the curve y=√x about the line y=1 from x=1 to x=4. 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' )