0% found this document useful (0 votes)
18 views

Assessment 2: Answer 1

Uploaded by

Niladri Mitra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Assessment 2: Answer 1

Uploaded by

Niladri Mitra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Assessment 2

Answer 1
Code:
clear
clc
syms x
f(x)=x^2-2*x;
g(x)=x;
I=[0,3];
a=I(1); b=I(2);
A=int(f(x)-g(x),a,b);
disp('Area bounded by the curves f(x) and g(x) is:' );
disp(A);
fplot(f(x),[a,b]);grid on;hold on;
fplot(g(x),[a,b]);
hold off
xlabel('x-axis');ylabel('y-axis');
legend('y=f(x)','y=g(x)');

Output:

Answer 2
Code:
clear all
clc
syms x
f(x)=4/(4+x^2);
yr=0;
I=[0,2];
a=I(1);b=I(2);
vol=pi*int((f(x)-yr)^2,a,b);
disp('Volume of solid of revolution is: ');
disp(vol);
fx=matlabFunction(f);
xv = linspace(a,b,101);
[X,Y,Z] = cylinder(fx(xv)-yr);
Z = a+Z.*(b-a);
surf(Z,Y+yr,X)
hold on;
plot([a b],[yr yr],'-r','LineWidth',2);
view(22,11);
xlabel('X-axis');ylabel('Y-axis');zlabel('Z-axis');

Output:

Answer 3
Code:
clear all
clc
syms s
F=input('Enter the function of s: ');
f=ilaplace(F);
disp('f(t) = ');
disp(f);

Output:

1) Enter the function of t:


a. 1+2*sqrt(t)+3/sqrt(t)
b. Laplace transform of f(t) =
1/s + (3*pi^(1/2))/s^(1/2) + pi^(1/2)/s^(3/2)

3) Enter the function of t:


c. (sin(t))^3
d. Laplace transform of f(t) =
6/((s^2 + 1)*(s^2 + 9))

4) Enter the function of t:


e. sin(2*t)*sin(3*t)
f. Laplace transform of f(t) =
s/(2*(s^2 + 1)) - s/(2*(s^2 + 25))

Code:
clear all
clc
syms t
f=input('Enter the function of t: ');
F=laplace(f);
F=simplify(F);
disp('Laplace transform of f(t) = ');
disp(F);

Output:

2) Enter the function of t:


sin(t)*(heaviside(t)-heaviside(t-pi))+0*(heaviside(t-pi)-heaviside(t-
2*pi))
Laplace transform of f(t) =
(exp(-pi*s)*(exp(pi*s) + 1))/(s^2 + 1)

Answer 4
Code:
clear all
clc
syms s
F=input('Enter the function of s: ');
f=ilaplace(F);
disp('f(t) = ');
disp(f);

Output:

1) Enter the function of s:


6/(s^2+2*s-8)
f(t) = exp(2*t) - exp(-4*t)

2) Enter the function of s:


(4*s+5)/((s-1)^2*(s+2))
f(t) = exp(t)/3 - exp(-2*t)/3 + 3*t*exp(t)

You might also like