Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
upayanmazumder committed Nov 27, 2024
1 parent f02962c commit 0ae1a5b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
clear
clc
syms y
f = input("Enter right curve f(y): ");
g = input("Enter left curve f(y): ");
L = input("Enter limits of integration: [a,b]: ");
a = L(1);b = L(2);
Area = int(f-g,y,a,b);
disp(Area);
y1 = linspace(a,b,20);x1 = subs(f,y,y1);
y2 = y1;x2 = subs(g,y,y2);
plot(x1,y1);hold on;plot(x2,y2);hold off;
xlabel('x-axis');ylabel('y-axis');
legend('f(x)','g(x)');grid on;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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);
x1 = linspace(a,b,20);y1 = subs(f,x,x1);
x2 = x1;y2 = subs(g,x,x2);
Area = int(f-g,x,a,b);
disp(['Area bounded by the curves f(x) and g(x) is ',char(Area)])
plot(x1,y1);hold on;plot(x2,y2);hold off;
xlabel('x-axis');ylabel('y-label');
legend('f(x)','g(x)');grid on;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
clear
clc
syms x
f = input('Enter curve f(x): ');
L = input('Enter limits [a,b]: ');
a = L(1);b=L(2);
Area = int(abs(f),x,a,b);
disp("The area is: ")
disp(Area)
x1 = linspace(a,b,20);y1 = subs(f,x,x1);
plot(x1,y1);
xlabel('x-axis');ylabel('y-label');
legend('f(x)');grid on;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
% Evaluation of Volume of solid of revolution
clear
clc
syms x
f(x)=sqrt(x); % Given function
yr=1; % Axis of revolution y=yr
I=[0,4]; % Interval of integration
a=I(1);b=I(2);
vol=pi*int((f(x)-yr)^2,a,b);
disp('Volume of solid of revolution is: ');
disp(vol); % Visualization if solid of revolution
fx=matlabFunction(f);
xv = linspace(a,b,101); % Creates 101 points from a to b
[X,Y,Z] = cylinder(fx(xv)-yr);
Z = a+Z.*(b-a); % Extending the default unit height of the
% cylinder profile to the interval of integration
surf(Z,Y+yr,X) % Plotting the solid of revolution about y=yr
hold on;
plot([a b],[yr yr],'-r','LineWidth',2); % Plotting the line y=yr
view(22,11); % 3-D graph viewpoint specification
xlabel('X-axis');ylabel('Y-axis');zlabel('Z-axis');

0 comments on commit 0ae1a5b

Please sign in to comment.