Professional Documents
Culture Documents
Coding:
clear all
clc
syms x
f=input('Enter the upper curve f(x): ');
g=input('Enter the lower curve g(x): ');
a=input('Enter the lower limit of
integration: ');
b=input('Enter the upper limit of
integration: ');
disp('Area bounded by the curves f(x)
and g(x) is: ')
Area=int(f-g,x,a,b)
ezplot(f)
hold on;
ezplot(g)
xlabel('x-axis');
ylabel('y-axis');
legend('f(x)','g(x)');
title('AREA BOUNDED BY TWO CURVES')
grid on;
OutPut:
Area =9/2
f(x)
6 g(x)
2
y-axis
-2
-4
-6
-6 -4 -2 0 2 4 6
x-axis
ASSIGNMENT-2B:
CODING:
clc
clear all
syms x
f=input('Enter the function f(x)');
c=input('Enter the axis of rotation
y = c (enter only c value): ');
a=input('Enter the lower limit of integration: ');
b=input('Enter the upper limit of integration: ');
disp('Volume of solid of revolution is: ');
vol=pi*int((f-c)^2,a,b)
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);
xlabel('x-axis');
ylabel('y-axis')
legend('The curve y=f(x)' ,
'The axis of revolution y=c');
title('volume of solid of revolution');
grid on;
Output:
vol =(32*pi)/3
1.6
1.4
1.2
y-axis
0.8
0.6
0.4
0.2
0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
x-axis