# Signal implementation with MATLAB

Download Signal implementation with MATLAB

## Preview text

Signal implementation with MATLAB

MATLAB is used frequently to simulate signals and systems. In this section, we present a few examples to illustrate the generation of different Continuous-time (CT) Signal and discrete-time (DT) signals in MATLAB. We also show how the CT and DT signals are plotted in MATLAB.

In this lab contains following categories.

Time domain 1. Using MATLAB for the following categories for signals:

A. Continuous-time and discrete-time signals 1. Plotting a continuous-time (CT) signal 2. Plotting a discrete-time (DT) signal

B. Periodic and aperiodic (or nonperiodic) signals C. Energy and power signals D. Even and odd signals. 2. Signal operations 3. Classification of systems 4. THE OUTPUT RESPONSE OF AN LTI- SYSTEM - Convolution in discrete time - Differential equations - Difference equations

Frequency Domain 5. Analysis of periodic signals: the trigonometric and exponential CTFS representations. 6. Analysis of aperiodic signals: the CTFT representations. 7. Discrete Fourier transform (DFT)

8. Difference equation with z-transform

Using MATLAB for the following categories for signals:

A. Continuous-time and discrete-time signals 1. Plotting a continuous-time (CT) signal

If a signal is defined for all values of the independent variable t, it is called a continuous-time (CT) signal.

We use a set of sample values from sampling of continuous-time (CT) signal to represent the

continuous time signal in a mathematical form. For example

>> t = [-5:0.001:5]; % % %

>> x = 5*sin(2*pi*t1) %

% plot x(t) >> plot(t,x); >> grid on; >> xlabel(‘time (t)’);

Set the time from -5 to 5 with a sampling rate of 0.001s

compute function x1

% plot a CT signal % turn on the grid % Label the x-axis as time

>> ylabel(‘5sin(2\pi t)’); % Label the y-axis

>> title(‘Part (a)’);

% Insert the title

First of all, the time value for which x (t) is to be plotted stored as element vector t. Second, create a vector with elements corresponding time values by the expression 5*sin(2*pi*t) . Third, by the command plot(t,x) , x is plotted versus t. The resulting plot of x(t) is shown in the figure. Two important things to note that, in generating a MATLAB plot of a continuoustime signal, first, to plot a continuous-time signal we use the command plot(t,x), and second , the increment in time step must be sufficiently small to yield a smooth plot.

Problem 1A. 1 Generate and sketch in the same figure each of the following CT signals using MATLAB. Do not use the “for” loops in your code. In each case, the horizontal axis t used to sketch the CT should extend only for the range over which the three signals are defined.

(a) x1(t ) = 5 sin(2πt+5 ) cos(πt − 8) for −5 ≤ t ≤ 5;

(b) x2(t ) = 5e−0.2t sin (2πt-3 ) for −10 ≤ t ≤ 10;

(c) x3(t ) = e(j4π−0.5)t u(t+2 ) for 5 ≤ t ≤ 15.

2. Plotting a discrete-time (DT) signal

In the last section when plotting sinusoidal signals using computer tools, we are also faced with the fact that only a discrete-time version of a continuous-time signal may be generated and plotted. This fact holds true whether we are using MATLAB, C, Mathematica, Excel, or any other computational tool. When we need to realize that sample spacing needs to be small enough relative to the frequency such that when plotted by connecting the dots, the waveform picture is not too distorted. For now we are more concerned with having a good plot appearance relative to the expected shape

In this section, on the other hand, if a signal is defined only at discrete values of time, it is called a discrete-time (DT) signal. We use as a set of sample values from sampling of continuoustime (CT) signal to represent the continuous time signal in a mathematical form.

In our notation, a CT signal is denoted by x(t ) with regular parenthesis, and a DT signal is denoted with square parenthesis ,x[k]. An important things to note that we use the command

stem(k,x) to plot a discrete-time signal.

Elementary signals

o Unit impulse function

The DT impulse function, also referred to as the Kronecker delta function on the DT unit sample function, is defined as follows:

Unlike the CT unit impulse function, the DT impulse function has no ambiguity in its definition; it is well defined for all values of k.

o Unit step function

The DT unit step function u[k] is defined as follows:

o Rectangular pulse function

The DT rectangular pulse rect(k/(2N + 1)) is defined as follows:

o Sinusoidal function

The DT sinusoid is defined as follows:

where

,

is the DT angular frequency. A CT sinusoidal signal x(t ) =sin( t + θ) is

always periodic, whereas its DT counterpart x[k] = sin( k +θ) is not necessarily

periodic. The DT sinusoidal signal is periodic only if the fraction /2π is a rational number.

o DT exponential function

The DT complex exponential function with radian frequency is defined as follows:

(1.39)

Case 1 Imaginary component is zero ( = 0). The signal takes the following form:

,

when the imaginary component of theDTcomplex frequency is zero. Similar to CT exponential functions, the DT exponential functions can be classified as rising, decaying, and constant-valued exponentials depending upon the value of σ.

Case 2 Real component is zero (σ = 0). The DT exponential function takes the following form:

Recall that a complex-valued exponential is periodic if /2π is a rational number. An alternative representation of the DT complex exponential function

Problem 1A. 2.1

Generate the following discrete time signals. Display the signals with the help of the

MATLAB function stem (k,x) to plot a discrete-time signal in the considered range of the k-

axis. = 0.9⋅

, 1≤ k ≤ 10

= 0.8⋅

, - 10 ≤ k ≤10

=1.5⋅

, 300 ≤ k ≤ 350

= 4.5⋅

, - 15 ≤ k ≤ 5

Problem 1A. 2.2 Repeat Problem 1.1 for the following DT sequences:

(a)

,−10 ≤ k ≤ 20;

(b)

, −5 ≤ k ≤ 25;

(c

,0 ≤ k ≤ 50.

B. Periodic and aperiodic signals

A CT signal x(t ) is said to be periodic if it satisfies the following property:

at all time t and for some positive constant T0. The smallest positive value of T0 that satisfies the periodicity condition, Eq. (1.3), is referred to as the fundamental period of x(t ).

Likewise, a DT signal x[k] is said to be periodic if it satisfies

at all time k and for some positive constant K0. The smallest positive value of that satisfies the periodicity condition, Eq. (1.4), is referred to as the fundamental period of x[k]. A signal that is not periodic is called an aperiodic or non-periodic signal.

The reciprocal of the fundamental period of a signal is called the fundamental frequency. Mathematically, the fundamental frequency is expressed as follows

, for CT signals or

for DT signals

where and are, respectively, the fundamental periods of the CT and DT signals. The frequency of a signal provides useful information regarding how fast the signal changes its amplitude. The unit of frequency is cycles per second(c/s) or hertz (Hz).

Sometimes, we also use radians per second as a unit of frequency. Since there are 2π radians

(or 360◦) in one cycle, a frequency of hertz is equivalent to 2π radians per second. If

radians per second is used as a unit of frequency, the frequency is referred to as the angular

frequency and is given by

, for CT signals, or

for DT signals

Although all CT sinusoidals are periodic, their DT counterparts

θ

may not always be periodic. An arbitrary DT sinusoidal sequence

is periodic if

is a rational number.

The term rational number is defined as a fraction of two integers. Given that the DT

sinusoidal sequence

is periodic, its fundamental period is evaluated

from the relationship

As

This can be extended to include DT complex exponential signals. Collectively, we state the following.

(1) The fundamental period of a sinusoidal signal that is evaluated by

with m set to the smallest integer that results in an integer value for .

(2) A complex exponential

θ to be periodic

. The fundamental period of a complex exponential is also given by

More over we can represent a periodic signal with a sum of single-period models each of which is shifted to be adjacent to another. That is

Where the model of one period signal starting at the arbitrary time Likewise for a discrete time signal

Where

Problem 1B. 1

The following term is given for the impulse sequence:

The total length of the sequence is MP, with P the period. Generate a impulse sequence s(k ) with the period P = 10 and a total length of 40 values. The start index shall be k=0 and the scaling factor Ai shall be identical 1.

Problem 1B. 2

The following MATLAB Code generates a sequence x: x=[0;1;1;0;1;0]*ones(1,7); x=x(:);

Display x with the help of the MATLAB function stem(k,x) and create a a sum of singleperiod models corresponding to the equation for the signal x .

Problem 1B. 3: Trigonometrical Sequence

a) Generate and display the following signals. Take care of the rage of the k-axis: , −25 ≤ k ≤ 25 , −25 ≤ k ≤ 25 , 0 ≤ k ≤ 55 , 0 ≤ k ≤ 55

Question: - Report a simple equation for x2(k) without using trigonometrical functions! - Why are x3(k) and x4(k) not periodical sequences?

C. Energy and power signals

The energy present in a CT or DT signal within a given time interval is given by the following:

CT signals

DT sequences

The total energy of a CT signal is its energy calculated over the interval t = [−∞,∞]. Likewise, the total energy of a DT signal is its energy calculated over the range k = [−∞,∞]. The expressions for the total energy are therefore given by the following: CT signals

DT sequences

Since power is defined as energy per unit time, the average power of a CT signal x(t )over the interval t = (−∞,∞) and of a DT signal x[k] over the range k = [−∞,∞] are expressed as follows: CT signals

DT sequences

Both equations are simplified considerably for periodic signals. Since a periodic signal repeats itself, the average power is calculated from one period of the signal as follows: CT signals

DT sequences

The symbols and are, respectively, the fundamental periods of the CT signal x(t ) and the DT signal x[k]. To illustrate this mathematically, we introduce the notation to imply that the integration is performed over a complete period and is independent of the lower limit. Likewise, while computing the average power of a DT signal x[k], the upper and lower limits of the summation can take any values as long as the duration of summation equals one fundamental period .

A signal x(t ), or x[k], is called an energy signal if the total energy has a non-zero finite value, 0 < < ∞. On the other hand, a signal is called a power signal if it has non-zero finite power, i.e. 0 < < ∞. Note that a signal cannot be both energy and a power signal simultaneously. The energy signals have zero average power whereas the power signals have infinite total energy.

Problem 1C. 1

Determine if the DT sequence g[k] = 3 cos(πk/10) is a power or an energy signal and also write an m-file for calculation.

D. Even and odd signals.

A CT signal (t ) is said to be an even signal if

Conversely, a CT signal (t ) is said to be an odd signal if

A DT signal

is said to be an even signal if

]

Conversely, a DT signal xo[k] is said to be an odd signal if

]

The even signal property, Eq. (1.16) for CT signals or Eq. (1.18) for DT signals, implies that an even signal is symmetric about the vertical axis (t = 0). Likewise, the odd signal property, Eq. (1.17) for CT signals or Eq. (1.19) for DT signals, implies that an odd signal is antisymmetric about the vertical axis (t = 0).

Such signals are classified in the “neither odd nor even” category. Neither odd nor even signals can be expressed as a sum of even and odd signals as follows:

where the even component

is given by

while the odd component

is given by

Fig. 1.7. (a) The CT signal x(t ) (b) Even component of x(t ). (c) Odd component of x(t ).

Problem 1D. 1

Determine if the following DT signals are even, odd, or neither even nor odd. In the latter case, evaluate and sketch the even and odd components of the DT signals: (i) x1[k] = sin(4k) + cos(2π/k3); (ii) x2[k] = sin(πk/3000) + cos(2πk/3); (iii) x3[k] =exp(j(7πk/4)) + cos(4πk/7 + π); (iv) x4[k] = sin(3πk/8) cos(63πk/64);

(v) x5[k] =

2. Signal operations

An important concept in signal and system analysis is the transformation of a signal. In this section, we consider three elementary transformations that are performed on a signal in the time domain. The transformations that we consider are time shifting, time scaling, and time inversion.

Time shifting

The time-shifting operation delays or advances forward the input signal in time. Consider a CT signal φ(t ) obtained by shifting another signal x(t) by T time units. The timeshifted signal φ(t ) is expressed as follows:

If T < 0 , the signal is said to be delayed in time. To obtain the time-delayed signal φ(t ) ,the origin of the signal x(t) is shifted towards the right-hand side by duration T along the t-axis.

On the other hand, if m > 0, the signal is advanced forward in time. The time-advanced signal φ(t ) is obtained by shifting x(t) towards the left-hand side by duration T along the t-axis.

The theory of the CT time-shifting operation can also be extended to DT sequences. When a DT signal x[k] is shifted by m time units, the delayed signal φ[k] is expressed as follows:

If m < 0, the signal is said to be delayed in time. To obtain the time-delayed signal φ[k], the origin of the signal x[k] is shifted towards the right-hand side along the k-axis by m time units. On the other hand, if m > 0, the signal is advanced forward in time. The time-advanced signal φ[k] is obtained by shifting x[k] towards the left-hand side along the k-axis by m time units.

Time scaling

The time-scaling operation compresses or expands the input signal in the time domain. A CT signal x(t ) scaled by a factor c in the time domain is denoted by x(ct). If c > 1 , the signal is compressed by a factor of c. On the other hand, if 0 < c < 1 the signal is expanded.

A CT signal x(t ) can be scaled to x(ct) for any value of c. For the DTFT, however, the time-scaling factor c is limited to integer values. We discuss the time scaling of the DT sequence in the following.

(i) Decimation

If a sequence x[k] is compressed by a factor c, some data samples of x[k] are lost. Compression (referred to as decimation for DT sequences) is, therefore, an irreversible process in the DT domain as the original sequence x[k] cannot be recovered precisely from the decimated sequence y[k].

(ii) Interpolation

In the DT domain, expansion (also referred to as interpolation) is defined as follows:

=

The interpolated sequence

inserts (m − 1) zeros in between adjacent samples

of the DT sequence x[k]. Interpolation of the DT sequence x[k] is a reversible process

as the original sequence x[k] can be recovered from

Time inversion

The time inversion (also known as time reversal or reflection) operation reflects the input signal about the vertical axis (t = 0). When a CT signal x(t ) is time reversed, the

inverted signal is denoted by x(−t ). Likewise, when a DT signal x[k] is time-reversed, the

inverted signal is denoted by x[−k].

Problem 2.1

Write a MATLAB function mydecimate with the following format:

function [y] = mydecimate(x, M) % MYDECIMATE: computes y[k] = x[kM] % where % x is a column vector containing the DT % signal % M is the scaling factor greater than 1 % y is a column vector containing the DT % decimated by M

input output

time

In other words, mydecimate accepts an input signal x[k] and produces the signal y[k] = x[kM].

Problem 2.2

Repeat the last problem for the transformation y[k] = x[k/N]. In other words, write a MATLAB function myinterpolate with the following format:

function [y] = myinterpolate(x, N) % MYINTERPOLATE: computes y[k] = x[k/N] % where

MATLAB is used frequently to simulate signals and systems. In this section, we present a few examples to illustrate the generation of different Continuous-time (CT) Signal and discrete-time (DT) signals in MATLAB. We also show how the CT and DT signals are plotted in MATLAB.

In this lab contains following categories.

Time domain 1. Using MATLAB for the following categories for signals:

A. Continuous-time and discrete-time signals 1. Plotting a continuous-time (CT) signal 2. Plotting a discrete-time (DT) signal

B. Periodic and aperiodic (or nonperiodic) signals C. Energy and power signals D. Even and odd signals. 2. Signal operations 3. Classification of systems 4. THE OUTPUT RESPONSE OF AN LTI- SYSTEM - Convolution in discrete time - Differential equations - Difference equations

Frequency Domain 5. Analysis of periodic signals: the trigonometric and exponential CTFS representations. 6. Analysis of aperiodic signals: the CTFT representations. 7. Discrete Fourier transform (DFT)

8. Difference equation with z-transform

Using MATLAB for the following categories for signals:

A. Continuous-time and discrete-time signals 1. Plotting a continuous-time (CT) signal

If a signal is defined for all values of the independent variable t, it is called a continuous-time (CT) signal.

We use a set of sample values from sampling of continuous-time (CT) signal to represent the

continuous time signal in a mathematical form. For example

>> t = [-5:0.001:5]; % % %

>> x = 5*sin(2*pi*t1) %

% plot x(t) >> plot(t,x); >> grid on; >> xlabel(‘time (t)’);

Set the time from -5 to 5 with a sampling rate of 0.001s

compute function x1

% plot a CT signal % turn on the grid % Label the x-axis as time

>> ylabel(‘5sin(2\pi t)’); % Label the y-axis

>> title(‘Part (a)’);

% Insert the title

First of all, the time value for which x (t) is to be plotted stored as element vector t. Second, create a vector with elements corresponding time values by the expression 5*sin(2*pi*t) . Third, by the command plot(t,x) , x is plotted versus t. The resulting plot of x(t) is shown in the figure. Two important things to note that, in generating a MATLAB plot of a continuoustime signal, first, to plot a continuous-time signal we use the command plot(t,x), and second , the increment in time step must be sufficiently small to yield a smooth plot.

Problem 1A. 1 Generate and sketch in the same figure each of the following CT signals using MATLAB. Do not use the “for” loops in your code. In each case, the horizontal axis t used to sketch the CT should extend only for the range over which the three signals are defined.

(a) x1(t ) = 5 sin(2πt+5 ) cos(πt − 8) for −5 ≤ t ≤ 5;

(b) x2(t ) = 5e−0.2t sin (2πt-3 ) for −10 ≤ t ≤ 10;

(c) x3(t ) = e(j4π−0.5)t u(t+2 ) for 5 ≤ t ≤ 15.

2. Plotting a discrete-time (DT) signal

In the last section when plotting sinusoidal signals using computer tools, we are also faced with the fact that only a discrete-time version of a continuous-time signal may be generated and plotted. This fact holds true whether we are using MATLAB, C, Mathematica, Excel, or any other computational tool. When we need to realize that sample spacing needs to be small enough relative to the frequency such that when plotted by connecting the dots, the waveform picture is not too distorted. For now we are more concerned with having a good plot appearance relative to the expected shape

In this section, on the other hand, if a signal is defined only at discrete values of time, it is called a discrete-time (DT) signal. We use as a set of sample values from sampling of continuoustime (CT) signal to represent the continuous time signal in a mathematical form.

In our notation, a CT signal is denoted by x(t ) with regular parenthesis, and a DT signal is denoted with square parenthesis ,x[k]. An important things to note that we use the command

stem(k,x) to plot a discrete-time signal.

Elementary signals

o Unit impulse function

The DT impulse function, also referred to as the Kronecker delta function on the DT unit sample function, is defined as follows:

Unlike the CT unit impulse function, the DT impulse function has no ambiguity in its definition; it is well defined for all values of k.

o Unit step function

The DT unit step function u[k] is defined as follows:

o Rectangular pulse function

The DT rectangular pulse rect(k/(2N + 1)) is defined as follows:

o Sinusoidal function

The DT sinusoid is defined as follows:

where

,

is the DT angular frequency. A CT sinusoidal signal x(t ) =sin( t + θ) is

always periodic, whereas its DT counterpart x[k] = sin( k +θ) is not necessarily

periodic. The DT sinusoidal signal is periodic only if the fraction /2π is a rational number.

o DT exponential function

The DT complex exponential function with radian frequency is defined as follows:

(1.39)

Case 1 Imaginary component is zero ( = 0). The signal takes the following form:

,

when the imaginary component of theDTcomplex frequency is zero. Similar to CT exponential functions, the DT exponential functions can be classified as rising, decaying, and constant-valued exponentials depending upon the value of σ.

Case 2 Real component is zero (σ = 0). The DT exponential function takes the following form:

Recall that a complex-valued exponential is periodic if /2π is a rational number. An alternative representation of the DT complex exponential function

Problem 1A. 2.1

Generate the following discrete time signals. Display the signals with the help of the

MATLAB function stem (k,x) to plot a discrete-time signal in the considered range of the k-

axis. = 0.9⋅

, 1≤ k ≤ 10

= 0.8⋅

, - 10 ≤ k ≤10

=1.5⋅

, 300 ≤ k ≤ 350

= 4.5⋅

, - 15 ≤ k ≤ 5

Problem 1A. 2.2 Repeat Problem 1.1 for the following DT sequences:

(a)

,−10 ≤ k ≤ 20;

(b)

, −5 ≤ k ≤ 25;

(c

,0 ≤ k ≤ 50.

B. Periodic and aperiodic signals

A CT signal x(t ) is said to be periodic if it satisfies the following property:

at all time t and for some positive constant T0. The smallest positive value of T0 that satisfies the periodicity condition, Eq. (1.3), is referred to as the fundamental period of x(t ).

Likewise, a DT signal x[k] is said to be periodic if it satisfies

at all time k and for some positive constant K0. The smallest positive value of that satisfies the periodicity condition, Eq. (1.4), is referred to as the fundamental period of x[k]. A signal that is not periodic is called an aperiodic or non-periodic signal.

The reciprocal of the fundamental period of a signal is called the fundamental frequency. Mathematically, the fundamental frequency is expressed as follows

, for CT signals or

for DT signals

where and are, respectively, the fundamental periods of the CT and DT signals. The frequency of a signal provides useful information regarding how fast the signal changes its amplitude. The unit of frequency is cycles per second(c/s) or hertz (Hz).

Sometimes, we also use radians per second as a unit of frequency. Since there are 2π radians

(or 360◦) in one cycle, a frequency of hertz is equivalent to 2π radians per second. If

radians per second is used as a unit of frequency, the frequency is referred to as the angular

frequency and is given by

, for CT signals, or

for DT signals

Although all CT sinusoidals are periodic, their DT counterparts

θ

may not always be periodic. An arbitrary DT sinusoidal sequence

is periodic if

is a rational number.

The term rational number is defined as a fraction of two integers. Given that the DT

sinusoidal sequence

is periodic, its fundamental period is evaluated

from the relationship

As

This can be extended to include DT complex exponential signals. Collectively, we state the following.

(1) The fundamental period of a sinusoidal signal that is evaluated by

with m set to the smallest integer that results in an integer value for .

(2) A complex exponential

θ to be periodic

. The fundamental period of a complex exponential is also given by

More over we can represent a periodic signal with a sum of single-period models each of which is shifted to be adjacent to another. That is

Where the model of one period signal starting at the arbitrary time Likewise for a discrete time signal

Where

Problem 1B. 1

The following term is given for the impulse sequence:

The total length of the sequence is MP, with P the period. Generate a impulse sequence s(k ) with the period P = 10 and a total length of 40 values. The start index shall be k=0 and the scaling factor Ai shall be identical 1.

Problem 1B. 2

The following MATLAB Code generates a sequence x: x=[0;1;1;0;1;0]*ones(1,7); x=x(:);

Display x with the help of the MATLAB function stem(k,x) and create a a sum of singleperiod models corresponding to the equation for the signal x .

Problem 1B. 3: Trigonometrical Sequence

a) Generate and display the following signals. Take care of the rage of the k-axis: , −25 ≤ k ≤ 25 , −25 ≤ k ≤ 25 , 0 ≤ k ≤ 55 , 0 ≤ k ≤ 55

Question: - Report a simple equation for x2(k) without using trigonometrical functions! - Why are x3(k) and x4(k) not periodical sequences?

C. Energy and power signals

The energy present in a CT or DT signal within a given time interval is given by the following:

CT signals

DT sequences

The total energy of a CT signal is its energy calculated over the interval t = [−∞,∞]. Likewise, the total energy of a DT signal is its energy calculated over the range k = [−∞,∞]. The expressions for the total energy are therefore given by the following: CT signals

DT sequences

Since power is defined as energy per unit time, the average power of a CT signal x(t )over the interval t = (−∞,∞) and of a DT signal x[k] over the range k = [−∞,∞] are expressed as follows: CT signals

DT sequences

Both equations are simplified considerably for periodic signals. Since a periodic signal repeats itself, the average power is calculated from one period of the signal as follows: CT signals

DT sequences

The symbols and are, respectively, the fundamental periods of the CT signal x(t ) and the DT signal x[k]. To illustrate this mathematically, we introduce the notation to imply that the integration is performed over a complete period and is independent of the lower limit. Likewise, while computing the average power of a DT signal x[k], the upper and lower limits of the summation can take any values as long as the duration of summation equals one fundamental period .

A signal x(t ), or x[k], is called an energy signal if the total energy has a non-zero finite value, 0 < < ∞. On the other hand, a signal is called a power signal if it has non-zero finite power, i.e. 0 < < ∞. Note that a signal cannot be both energy and a power signal simultaneously. The energy signals have zero average power whereas the power signals have infinite total energy.

Problem 1C. 1

Determine if the DT sequence g[k] = 3 cos(πk/10) is a power or an energy signal and also write an m-file for calculation.

D. Even and odd signals.

A CT signal (t ) is said to be an even signal if

Conversely, a CT signal (t ) is said to be an odd signal if

A DT signal

is said to be an even signal if

]

Conversely, a DT signal xo[k] is said to be an odd signal if

]

The even signal property, Eq. (1.16) for CT signals or Eq. (1.18) for DT signals, implies that an even signal is symmetric about the vertical axis (t = 0). Likewise, the odd signal property, Eq. (1.17) for CT signals or Eq. (1.19) for DT signals, implies that an odd signal is antisymmetric about the vertical axis (t = 0).

Such signals are classified in the “neither odd nor even” category. Neither odd nor even signals can be expressed as a sum of even and odd signals as follows:

where the even component

is given by

while the odd component

is given by

Fig. 1.7. (a) The CT signal x(t ) (b) Even component of x(t ). (c) Odd component of x(t ).

Problem 1D. 1

Determine if the following DT signals are even, odd, or neither even nor odd. In the latter case, evaluate and sketch the even and odd components of the DT signals: (i) x1[k] = sin(4k) + cos(2π/k3); (ii) x2[k] = sin(πk/3000) + cos(2πk/3); (iii) x3[k] =exp(j(7πk/4)) + cos(4πk/7 + π); (iv) x4[k] = sin(3πk/8) cos(63πk/64);

(v) x5[k] =

2. Signal operations

An important concept in signal and system analysis is the transformation of a signal. In this section, we consider three elementary transformations that are performed on a signal in the time domain. The transformations that we consider are time shifting, time scaling, and time inversion.

Time shifting

The time-shifting operation delays or advances forward the input signal in time. Consider a CT signal φ(t ) obtained by shifting another signal x(t) by T time units. The timeshifted signal φ(t ) is expressed as follows:

If T < 0 , the signal is said to be delayed in time. To obtain the time-delayed signal φ(t ) ,the origin of the signal x(t) is shifted towards the right-hand side by duration T along the t-axis.

On the other hand, if m > 0, the signal is advanced forward in time. The time-advanced signal φ(t ) is obtained by shifting x(t) towards the left-hand side by duration T along the t-axis.

The theory of the CT time-shifting operation can also be extended to DT sequences. When a DT signal x[k] is shifted by m time units, the delayed signal φ[k] is expressed as follows:

If m < 0, the signal is said to be delayed in time. To obtain the time-delayed signal φ[k], the origin of the signal x[k] is shifted towards the right-hand side along the k-axis by m time units. On the other hand, if m > 0, the signal is advanced forward in time. The time-advanced signal φ[k] is obtained by shifting x[k] towards the left-hand side along the k-axis by m time units.

Time scaling

The time-scaling operation compresses or expands the input signal in the time domain. A CT signal x(t ) scaled by a factor c in the time domain is denoted by x(ct). If c > 1 , the signal is compressed by a factor of c. On the other hand, if 0 < c < 1 the signal is expanded.

A CT signal x(t ) can be scaled to x(ct) for any value of c. For the DTFT, however, the time-scaling factor c is limited to integer values. We discuss the time scaling of the DT sequence in the following.

(i) Decimation

If a sequence x[k] is compressed by a factor c, some data samples of x[k] are lost. Compression (referred to as decimation for DT sequences) is, therefore, an irreversible process in the DT domain as the original sequence x[k] cannot be recovered precisely from the decimated sequence y[k].

(ii) Interpolation

In the DT domain, expansion (also referred to as interpolation) is defined as follows:

=

The interpolated sequence

inserts (m − 1) zeros in between adjacent samples

of the DT sequence x[k]. Interpolation of the DT sequence x[k] is a reversible process

as the original sequence x[k] can be recovered from

Time inversion

The time inversion (also known as time reversal or reflection) operation reflects the input signal about the vertical axis (t = 0). When a CT signal x(t ) is time reversed, the

inverted signal is denoted by x(−t ). Likewise, when a DT signal x[k] is time-reversed, the

inverted signal is denoted by x[−k].

Problem 2.1

Write a MATLAB function mydecimate with the following format:

function [y] = mydecimate(x, M) % MYDECIMATE: computes y[k] = x[kM] % where % x is a column vector containing the DT % signal % M is the scaling factor greater than 1 % y is a column vector containing the DT % decimated by M

input output

time

In other words, mydecimate accepts an input signal x[k] and produces the signal y[k] = x[kM].

Problem 2.2

Repeat the last problem for the transformation y[k] = x[k/N]. In other words, write a MATLAB function myinterpolate with the following format:

function [y] = myinterpolate(x, N) % MYINTERPOLATE: computes y[k] = x[k/N] % where

## Categories

## You my also like

### School Of Electrical And Electronics Department Of

3.1 MB55.1K17.6K### EEG Signal Analysis: A Survey

766.1 KB28.4K2.8K### Digital Signal Processing Unit 1 Signals And Systems

418 KB42985### Experiment 8 Amplitude Modulation and Demodulation

278.5 KB25.7K12.3K### Continuous Wave Radar

295.5 KB13.7K4.4K### Chapter 1: Classiﬁcation of Signal and System

556.5 KB7.4K1.5K### Analysis Of H Nmr Spectra

622.9 KB78.6K20.4K### Chapter 10 Evolution of Communication 1st lecture

1.2 MB74.9K36K### Luminous Intensity for Traffic Signals: A Scientific Basis

561.8 KB17.5K7.5K