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

Practical 02

The document provides an introduction to generating common signal types such as periodic, exponential, step and other functions using MATLAB's Signal Processing Toolbox. It describes how to generate signals like square waves, triangular waves, sinusoidal waves, decaying and growing exponentials, step functions and more using built-in MATLAB commands. The document also includes exercises asking the reader to generate various signal types and perform operations on signals like scaling, shifting and combining using the toolbox functions.

Uploaded by

rizwanahmed06
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Practical 02

The document provides an introduction to generating common signal types such as periodic, exponential, step and other functions using MATLAB's Signal Processing Toolbox. It describes how to generate signals like square waves, triangular waves, sinusoidal waves, decaying and growing exponentials, step functions and more using built-in MATLAB commands. The document also includes exercises asking the reader to generate various signal types and perform operations on signals like scaling, shifting and combining using the toolbox functions.

Uploaded by

rizwanahmed06
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Institute of Information and Communications Technologies

Mehran University of Engineering & Technology, Jamshoro, Pakistan

Data Communication & Networks


January 10, 2011 Practical #02 Time 5:00 to 7:00

discrete time signal at the time values defined by


Introduction to Signal Processing Toolbox n. The vectors n and x must, of course, have
compatible dimensions.
The MATLAB Signal Processing Toolbox has a Consider, for example, the discrete time
large variety of functions for generating square wave, with frequency /4 radians per
continuous-time and discrete time signals. In this second, duty cycle = 0.5 and amplitude = 1
lab, how to generate some commonly used unit. This signal is generated using the
signals will be learnt and some operations will following commands:
also be performed on signals.
A=1;
Generation of Signals w=pi/4;
Periodic Signals rho=0.5;
It is an easy matter to generate periodic signals n=-10:1:10;
such as square waves, triangular waves and x=A*square(w*n+rho);
sinusoidal signals using MATLAB. stem(n,x)
Consider first the generation of a triangular wave
of amplitude A, fundamental frequency w0 Exponential Signals
(measured in radians per second) and width W.
The basic command for generating this signal is There are two types of exponential signals:
A*sawtooth(w0*t + W); decaying exponentials and growing exponentials.
Thus to generate a triangular wave of The MATLAB command for decaying exponential
amplitude = 1 unit, a frequency of 10 radians Be-at is
per second and a width of 0.5 unit, one can B*exp(-a*t);
use the following commands: To generate a growing exponential Beat ,we use
command
A=1; B*exp(a*t);
w0=10*pi; In both cases, the exponential parameter a is
W=0.5; positive.
t=0:0.001:1;
tr=A*sawtooth(w0*t+W); Other Functions
plot(t,tr) A discrete time unit step function may be created
as follows:
Consider next the generation of a square wave n = 0:1:20;
of amplitude A, fundamental frequency w0 and x = ones(1, length(n));
duty cycle . stem(n,x)
To generate such a signal, use the command axis([-1 25 0 2]) % optional
A*square(w0*t + rho);
The square wave with amplitude 1, Exercise
fundamental frequency 10 radian per second 1. Generate a discrete time triangular wave of
and duty cycle = 0.5 can be generated by unity amplitude with width 0.5 and frequency
using the following commands: 10 radians per second.
A=1; 2. Draw the following sinusoidal signals:
w0=10*pi; (i) Acos(wt + ) (ii) Asin(wt + )
rho=0.5; where A = 4; w = 20 and  = 30 degrees.
t=0:0.001:1; % linspace(0,1,1000); N.B. Convert degrees into radians.
q=A*square(w0*t + rho);
plot(t,sq) 3. Draw the following signals:
axis([0 1 -2 2]) % Optional command (a) x(t) = 5e-6t (b) y(t) = 3e5t
for better visualization (c) x[n] = 2(0.85)n
(d) z(t) = 60sin(20)e-6t
To visualize a discrete time signal, one may use (e) y[n] = 60sin(20n)e-6n.
the stem command. Specifically, stem(n,x)
depicts the data contained in vector x as a
4. Draw the following discrete time functions
(i) x[n] = n (ramp function)
(ii) x[n] = [n] (impulse function)

5. Using the built-in function “sinc”, plot sinc


function (i.e. sin(x)/x) for x between –5 and
5.

6. Plot a rectangular function of width 3 units.


(use the built-in function “rectpuls”.

7. Draw a discrete time triangular pulse using


the built-in function “tripuls”.

8. Plot u[n] – u[n-5], where u[n] is a discrete


time unit step signal.

4n
x [nT ]=
9. Plot the discrete time signal 2+n2
,

T = 2. On the same graph paper, plot the


following:
a. x[nT], T = 3.
b. x[nT] = 0.5
c. x[(n+4)T], T = 2
d. x[(n-2)T, T = 0.75

10. Plot the continuous time signal


x(t) = t/(t2 + 4). On the same graph, plot the
following:
1. x(1.5t) 2. x(0.8t)
3. x(t+3.6) 4. x(2t-1)

You might also like