You are on page 1of 3

ECE323L ACTIVITY 1 ILLUSTRATIVE PROBLEM

1. Given the signal x(t) shown as

(a) Determine the mathematical expression for x(t)


x(t) = 0, t < -8
= 4, -8 t < -5
= 4 + 6sin(0.25t + 1.25), -5 t < -1
= 4, -1 t < 2
= 6-t, 2t 6
= 0, 6t

(b) Plot the graph for x(t) using SCILAB for -10 t 10.


(c) Evaluate: x(t) dt = 63.278874
-

10
(d) Evaluate: x2(t) dt = 327.56432
-5

(e) Plot the graph of y(t) for -25 t 25 if y(t) = 2 - 3x(0.4t+0.5)


0
(f) Evaluate: y(t) dt = - 309.65146
-30

SCILAB Program:
clear; clc; clf;

//Scilab function for x(t)


//The function returns the value of x for each value of t array-wise
function xv=x(t)
[m,n]=size(t)
for r=1:m
for c=1:n
if t(r,c)<-8 then
xv(r,c)=0; end;
if t(r,c)>=-8 & t(r,c)<-5 then
xv(r,c)=4; end;
if t(r,c)>=-5 & t(r,c)<-1 then
xv(r,c)=4+6*sin(0.25*%pi*t(r,c)+1.25*%pi); end;
if t(r,c)>=-1 & t(r,c)<2 then
xv(r,c)=4; end;
if t(r,c)>=2 & t(r,c)<=6 then
xv(r,c)=6-t(r,c); end;
if t(r,c)>6 then
xv(r,c)=0; end;
end;
end;
endfunction;

// (b) Plot the graph


t=-10:0.01:10;
clf; plot2d(t,x(t)); xgrid();

// (c) Evaluate the integral of x(t) from negative infinity to infinity


// Since x(t) is zero for t<-8 and for t>6, the limits of integration
// can be changed as from t=-8 to t=6
t=-8:0.001:6;
C=inttrap(t, x(t))

//(d) Evaluate the integral of the square of x(t) from t=-5 to t=10
t=-5:0.001:10;
D=inttrap(t,x(t).^2)

//(e) Plot the graph of y(t) from t=-25 to t 25 if y(t)=2-3x(0.4t+0.5)


t=-25:0.01:25;
clf; plot2d(t,2-3*x(0.4*t+0.5)); xgrid();
//(f) Evaluate the integral of y(t) from t=-30 to t=0 if y(t)=2-3x(0.4t+0.5)
t=-30:0.01:0;
F=inttrap(t,2-3*x(0.4*t+0.5))

You might also like