06.06.2022 Views

B. P. Lathi, Zhi Ding - Modern Digital and Analog Communication Systems-Oxford University Press (2009)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

48 SIGNALS AND SIGNAL SPACE

Figure 2.19

Graphing a

signal.

2

Ynn time domain

0

-1

-2

-3

-2 -1.5 -1 -0.5 0 0.5 1.5 2 2.5 3

function y=triangl (t)

y = (1-abs (t)). * (t>=-1) . * (t<l) ;

end

We now show how to use MATLAB to generate a simple signal plot through an example.

siggraf . mis provided. In this example, we construct and plot a signal

y(t) = exp (-t) sin (6:n:t)u(t + 1 )

The resulting graph shown in Fig. 2.19.

% (file name : siggraf .m)

% To graph a signal , the first step is to determine

% the x-axis and the y-axis to plot

% We can first decide the length of x-axis to plot

t= [-2:0.01:3]; % "t" is from -2 to 3 in 0.01 increment

% Then evaluate the signal over the range of "t" to plot

y=exp (-t) .*sin ( l0*pi*t) .*ustep(t+l) ;

figure (l) ; figl=plot (t,y) ; % plot t vs y in figure 1

set (figl , 'Linewidth ' ,2) ;

xlabel ('\it t');

% choose a wider line-width

% use italic 't' to label x-axis

ylabel ('\{\bf y\} ( \{\i t t} ) '); % use boldface 'y'

to label y-axis

title ('\{\bf y\ }\_\{\rm time domain\}'); % can use subscript

Periodic Signals and Signal Power

Periodic signals can be generated by first determining the signal values in one period before

repeating the same signal vector multiple times.

In the following MATLAB program PfuncEx . m, we generate a periodic signal and

observe its behavior over 2M periods. The period of this example is T = 6. The program also

evaluates the average signal power which is stored as a variable y __power and signal energy

in one period which is stored in variable y_energyT.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!