0% found this document useful (0 votes)
29 views5 pages

Module 2

Uploaded by

Sumukh Kini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
29 views5 pages

Module 2

Uploaded by

Sumukh Kini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

Module -2 (Signals & Systems) –Part 1

➢ Defining/Creating the Continuous-time Signal :


• Inline functions { >> prompt is used in every following MATLAB Statements}
Any signals are most conveniently represented using MATLAB built-in command (object) inline.
Ex: Consider a continuous time everlasting signal: x(t) = e-tcos(2πt) which can be expressed as,
>>x = inline('exp(-t).*cos(2*pi*t)','t')
Once defined, x(t) can be evaluated simply by passing the input arguments as,
Ex: >> t = 0; % t is a scalar value
>> x(t) % x(t) is a scalar value which is computed by passing t = 0 in “x” inline object.
======== > ans = 1
Similarly, an array “x(t)” can be created by defining “t” over the interval -2 ≤ t ≤ 2 as (signal duration)
>> t= [-2:.01:2]; % is an array whose values vary from-2 to 2 which also the is presentation duration
>> x(t) % is an array whose values are computed by passing “t” in “x” inline object.
======== > ans = …… 100 values of x(t) …….
>> plot(t,x(t)); % sketch of the above function.
>>u=inline('t>=0','t') % creates a unit step function.
>>p=inline('((t>=0)&(t<1))','t') % creates a unit pulse of duration 1s. Logical “1” is defined between 0 to 1.

NOTE: To achieve an accurate representation of discontinuity in the signals like “step”, while defining the
continuous-time signals, it is recommended to adopt at least 100 samples per unit x-axis value. Increment
chosen in array must be < 0.01.

Constructing energy signal (finite duration signal) from everlasting signal


>>x = inline('exp(-t).*cos(2*pi*t) .* ((t>=-2)&(t<1)) ','t')
% creates a function x(t) valid for interval -2 to 1s (signal non-zero range).
Note: signal non-zero duration is -2 to 1s, but presentation duration is -2 ≤ t ≤ 2 as chosen above
>>p = inline('t.* ((t>=0)&(t<1)) + exp(-t).* ((t>=1)&(t<2)) ','t')
creates a single function made out of two different functions valid for two different intervals.
>>plot(t,p(-t)) % sketch of the above defined functions after reversing
>>plot(t,p(t-5)) % sketch of the above function time shifted right (delay) by 5 sec.
>>plot(t,p(2t) % sketch of the above function compressed in time by a factor 2

To calculate the energy of a signal - method -1


>>f=inline('exp(-t).*cos(2*pi*t).*((t>=-2)&(t<1))','t')
>>t=[-4.1:.001:4.1]; % defines the range of t with increment 0.001

1
>>dt=0.001; % defines increment for integration 0.001 (should be same as above)
>>energy1=sum((f(t).*f(t))*dt) % computes the energy of the signal

To find the ODD and EVEN components:


EVEN : >> xe = 0.5*(f(t)+f(-t)) % computing even part of signal
ODD : >> xo = 0.5*(f(t)-f(-t)) % computing odd part of signal
Note: Care should be taken in selecting the presentation duration i.e. t=[-4.1:.001:4.1]; such a way that full
duration of odd / even components are presented.

To calculate the energy, Even & Odd part of a signal – method -2: without using “inline” objects:
t = -4.1:0.01:4.1; % creating array of time (presentation duration)
x = exp(-t).*cos(2*pi*t).*((t>=-2)&(t<1)); % signal definition with non-zero between -2 to 1
energy2 = sum(x.^2*0.01) % computing energy (discussed in following section)
xr = exp(t).*cos(2*pi*(-t)).*((t>=-1)&(t<2)); % creating time reversal of signal without “inline” object
plot(t,x,’r’,t,xr,’g’) % sketching the signal and reversed signal
EVEN : >> xe = 0.5*( x+xr) % computing even part of signal
ODD : >> xo = 0.5*( x-xr) % computing odd part of signal
>>plot(t,xe) sketch of the above computed even function
>>plot(t,xo) sketch of the above computed odd function

➢ Defining/Creating the Discrete-time Signal :


To achieve this increment chosen should be equal to “1” while defining array in x-axis.
The same above inline function can be used here.
Consider a discrete time function: f [n] = e-n/10cos(nπ/10)u[n], can be expressed as,
>>f = inline('exp(-n/10).*cos(n*pi/5).* (n>=0) ','n') defines the function for the signal variation for all value of n.
Sketching the discrete time function f[n] over (-10 ≤ n ≥ 20)
>>n= [-10:20]; creates the range for running variables. (note: increment is 1)
>>stem(n,f(n),’k’); sketch of the above function as the discrete time nature.
>>f= inline('exp(-n/10).*cos(n*pi/5).*((n>=0)&(n<11))','n')
creates a causal function with nonzero values upto n= 11
>>stem(n,f(n/2),'k'); expand (interpolate) the above function by a factor 2
>>stem(n,f(n*2),'k'); compress (decimate) the above function by a factor 2

2
Exercises
Try to sketch the following signals shown in fig a) to fig g), over a suitable range.
Find x(-t), x(t+60), x(3t), x(t/20), x(2t+8), -3x(-0.2t-80)+1.5, 2x(2-t)-4
1 
 cos( wt ) + 1, −  / w  t   / w
1) The raised cosine pulse x(t) is defined as x(t ) =  2 
 0, otherwise 
Plot the curve and determine the total energy of x(t).
5 − t 4t 5 
 1 − 4  t  4 

2) The trapezoidal pulse x(t) is defined by x(t ) =   Plot the curve and determine the total
t + 5 − 5  t  −4
 0 otherwise 
energy of x(t).
3) Modify the signal in the exercise no.2, as x[nT], as a discrete time signal with sampling period T= 0.5, & 1
sec, and plot the discrete time signal and calculate the energy of the signal & compare it with the continuous
time signal.
4) Find and plot over a suitable range, the following signals, the even and odd components of each of the
signals:
a) x(t) = cos(t) + sin(t) + sin(t) cos(t)
b) x(t) 1 + t + 3t2 + 5t2 + 9t4
c) x(t) = 1+ t cos(t) + t2 sin(t) + t3 sin(t) cos(t)
d) x(t) = (1+ t3) cos3(10t)
5) Consider the signal x(t) shown in fig. 1,
a) Determine and carefully sketch v(t) = 3x(-(1/2)(t+1))
b) Determine the Energy OR Power of v(t).
c) Determine and sketch the even portion of v(t)
d) Let a=2 and b= 3, sketch v(at+b), v(at)+b, av(t+b), and av(t)+b
e) Let a=-3 and b= -2, sketch v(at+b), v(at)+b, av(t+b), and av(t)+b
f) Repeat the above exercise, considering the signal shown in fig.2, and considering odd portion in c)
g) Repeat the above exercise, considering the signal shown in fig.3, and consider both even & odd
portion in c)
6) Consider the signal –(1/2)x(-3t+2) shown in fig.4,
a) Determine and carefully sketch the original signal x(t)
b) Determine and sketch the even portion of the original signal x(t)
c) Determine and sketch the odd portion of the original signal x(t)

3
4
Module -2 (Signals & Systems) –Part 2
Exercises
1) Plot the signals shown in fig a) to fig e), over a suitable range. Also calculate the size of the
signals and find x(-n), x(n+6), x(n-6), x(3n), x(n/2), -3x(-0.2n+12)+5, x(3-n)

2) Sketch over a suitable range and find the size of the following signals:
 
(1)n , (-1)n , u[n} , (-1)nu[n] , cos  n +  .
3 6
3) Sketch over a suitable range, the following signals, find out odd and even
components.
1 n  n 
a) 2 sin  , b) n(n-1) υn u[n-2] for υ = 0.8 and -0.8.
2  3 
 n 
c) (u[n]+(-1)n+1u[n] ) cos  , d) n{u[n] – u[n-7] }
 2 
e) (-n+8){u[n-6] – u[n-9] } , f) (n-2){u[n-2] – u[n-6] }+(-n+8){u[n-6] – u[n-9] }

You might also like