Professional Documents
Culture Documents
Act 6
Act 6
LABORATORY ACTIVITY #6
I. Learning Outcomes:
At the end of the laboratory activity, the students should be able to:
1. Use MATLAB to solve the derivative and integral of a given mathematical function
2. Use MATLAB to obtain linear transforms of higher equations such as Laplace Transforms and Fourier
Transform
b. MATLAB Codes:
1.
>> syms x n;
>> f=x^n;
>> k=diff(f)
2.
>> syms a t b
>> f=sin(a*t+b);
>> k=diff(f)
3.
>> f=[1 3 1];
>> polyder(f)
4.
>> symvar x;
>> f=log(x);
>> k=diff(f)
1.
>> syms f x y
>> f=5*log(x*y);
>> k=diff(f,'x')
>> l=diff(f,'y')
2.
>> syms f x y
>> f=2*y*sin(x^2);
>> k=diff(f,'x')
>> l=diff(f,'y')
1.
>> syms f x y
>> f=2*x^5*y^3-3*x^4*y^2+9*x^2*y;
>> k=diff(f,'x',2)
>> l=diff(f,'y',2)
2.
>> syms f x y
>> f=10*cos(x*y^2);
>> k=diff(f,'x',2)
>> l=diff(f,'y',2)
c. Answer:
1.
k=
n*x^(n - 1)
2.
k=
a*cos(b + a*t)
3.
ans =
2 3
4.
k=
1/x
1.
k=
5/x
l=
5/y
2.
k=
4*x*y*cos(x^2)
l=
2*sin(x^2)
1.
k=
12*y*x^5 - 6*x^4
2.
k=
-10*y^4*cos(x*y^2)
l=
- 20*x*sin(x*y^2) - 40*x^2*y^2*cos(x*y^2)
2.
a. Problem: Integral
b. MATLAB Codes:
1.
>> syms x n
>> f=x^n;
>> k=int(f)
2.
>> syms a t b
>> f=sin(a*t+b);
>> k=int(f)
3.
>> f=[1 3 1];
>> polyint(f)
4.
>> symvar x;
>> f=log(x);
>> k=int(f)
1.
>> syms f x y
>> f=(1-x)/(x*y);
>> k=int(f,x)
>> l=int(f,y)
2.
>> syms f x y pi
>> f=2*y*sin(pi*x^2);
>> k=int(f,x)
>> l=int(f,y)
1.
>> syms f x y
>> f=2*x^5*y^3-3*x^4*y^2+9*x^2*y;
>> k=int(f,x,2)
>> l=int(f,y,2)
2.
>> syms f x y pi
>> f=10*cos(2*pi*x*y^2);
>> k=int(f,x,2)
>> l=int(f,y,2)
1.
>> syms f x
>> f=-x^3;
>> l=int(f,0,3)
2.
>> syms f x pi
>> f=x^2*sin(pi*x);
>> k=int(f,0,3)
c. Answer:
1.
k=
2.
k=
-cos(b + a*t)/a
3.
ans =
x*(log(x) - 1)
1.
k=
-(x - log(x))/y
l=
-(log(y)*(x - 1))/x
2.
k=
2^(1/2)*y*fresnels(2^(1/2)*x)
l=
y^2*sin(pi*x^2)
1.
k=
2.
k=
-(5*(sin(2*pi*x*y^2) - sin(4*pi*y^2)))/(y^2*pi)
l=
-(5*(sin(2*pi*y^3) - sin(4*pi*y^2)))/(y^2*pi)
1.
l=
-81/4
2.
k=
(9*pi^2 - 4)/pi^3
3.
a. Problem: Laplace Transform
b. MATLAB Codes:
1.
>> syms t
>> f=10*sin(2*t);
>> k=laplace(f)
2.
>> syms t
>> f=2*cosh(4*t);
>> k=laplace(f)
3.
>> syms t
>> f=5*cos(5*t);
>> k=laplace(f)
4.
>> syms t
>> f=2*t^3*exp(2*t);
>> k=laplace(f)
5.
>> syms t
>> f=6*exp(-6*t);
>> k=laplace(f)
c. Answer:
1.
k=
20/(s^2 + 4)
2.
k=
(2*s)/(s^2 - 16)
3.
k=
(5*s)/(s^2 + 25)
4.
k=
12/(s - 2)^4
5.
k=
6/(s + 6)
4.
a. Problem: Inverse Laplace
b. MATLAB Codes:
1.
>> syms s
>> f=1/s^4;
>> k=ilaplace(f)
2.
>> syms s
>> f=5/(s^2+16);
>> k=ilaplace(f)
3.
>> syms s
>> f=2/(s+3)^3;
>> k=ilaplace(f)
4.
>> syms s
>> f=(s+2)/((s+2)^2+1);
>> k=ilaplace(f)
5.
>> syms s
>> f=(2/(s-2)^3)+(2/(s-2)^2)+(1/(s-2));
>> k=ilaplace(f)
c. Answer:
1.
k=
t^3/6
2.
k=
(5*sin(4*t))/4
3.
k=
t^2*exp(-3*t)
4.
k=
exp(-2*t)*cos(t)
5.
k=
5.
a. Problem: Fourier Trnsform
b. MATLAB Codes:
1.
>> syms t
>> a=10*dirac(t);
>> y=fourier(a)
2.
>> syms t
>> b = cos(500*pi*t);
>> u=fourier(b)
3.
>> syms t
>> c=exp(-2*t);
>> i=fourier(c)
4.
>> syms t
>> d=t^2*exp(-abs(t));
>> o=fourier(d)
c. Answer:
1.
y=
10
2.
u=
3.
i=
fourier(exp(-2*t), t, w)
4.
o=