-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f02962c
commit 0ae1a5b
Showing
5 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
MATLAB/Area/Area between curves/Area bounded by curves of form x = f(y)/code.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
14 changes: 14 additions & 0 deletions
14
MATLAB/Area/Area between curves/Area bounded by curves of form y = f(x)/code.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
13 changes: 13 additions & 0 deletions
13
...AB/Area/Area under the curve/Area under a curve between two values of x and x-axis/code.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
14 changes: 0 additions & 14 deletions
14
...Area/The area bounded by the curves π¦ = 2 β π₯ and the line π¦ = βx from π₯ = β1 to 2/code.m
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
.../Solids of Revolution/Revolving a curve y = x^(1/2) about line y=1 from x=1 to x=4/code.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |