Sin categoría

# Elementary sequences in digital signal processing with Matlab

In MATLAB we can represent a finite-duration sequence by a row vector of appropriate values. However, such a vector does not have any information about sample position n. therefore, a correct representation of a discrete function x[n] would require two vectors, one each for x and n. For example, a sequence x[n] ={2,1,-1,0,1,4,3,7} can be represented in Matlab by:

n=[-3,-2,-1,0,1,2,3,4];
x=[2,1,-1,0,1,4,3,7];
stem(n,x)
xlabel(‘n’); ylabel(‘x[n]’)
title(‘x[n] sequence’)

Generally, we will use the x-vector representation alone when the sample position information is not required or when such information is trivial (e.g. when the sequence begins at n=0)

`Types of sequences`

We use several elementary sequences in Digital Signal Processing for analysis purposes.

`Unit Sample sequence`

The function zeros(1,N) generates a row vector of N zeros, which can be used to implement δ[n] over a finite interval. However, the logical relation n==0 is an elegant way of implementing δ[n]. For example, to implement:

Over the n1< no < n2  interval, will use the following Matlab function:

function[x,n]=impseq(n0,n1,n2)

% write in the editor…generates x[n]=delta(n-no); n1<=n<=n2

n=[n1:n2]; x=[(n-n0)==0];

Now, we can use the impseq function as follows, to implement an arbitrary function T=δ[n-5] over the 0< no < 9  interval:

n=0:9;
T=impseq(5,0,9);
stem(n,T)
xlabel(‘n’); ylabel(‘T[n]’)
title(‘T[n] sequence’)

% write in the command windows

Result:

T =     0     0     0     0     0     1     0     0     0     0

Note: to see how to implement a Matlab function see: matlab getstart, page 176, (4-22)

The power of this approach can be see in the follow example.

Example 1. Generate and plot the following sequence over the indicated interval:

n=[-5:5];
x=2*impseq(-2,-5,5)-impseq(4,-5,5);
stem(n,x); title(‘Secuencia de Problema 1’)
xlabel(‘n’); ylabel(‘x[n]’)

This commands yield:

`Unit Step sequence`

The function ones(1,N) generates a row vector of N ones. It can be used to generate u[n] over a finite interval. Once again, an elegant approach is to use the logical relation n>=0. To implement:

Over the n1< no < n2  interval, will use the following Matlab function:

function[x,n]=stepseq(n0,n1,n2)

% Generates x(n)=u(n-n0); n1<=n<=n2

n=[n1:n2]; x=[(n-n0)>=0];

Now, we can use the stepseq function as follows, to implement an arbitrary function P=u[n-5] over the 0< no < 18 interval:

>> P=stepseq(5,0,18)

Result:

P =     0     0     0     0     0     1     1     1     1     1     1     1     1     1     1     1     1     1     1

Example 2. Generate and plot each of the following sequence over the indicated interval:

n=[0:20]; x1=10*exp(-0.3*(n-10)).*(stepseq(10,0,20)-stepseq(20,0,20));

x2=n.*(stepseq(0,0,20)-stepseq(10,0,20));
x=x1+x2;
stem(n,x); title(‘Secuencia de Problema 2’)

This commands yield:

`Real-valued exponential sequence`

In Matlab an array operator “” is required to implement a real exponential sequence of the form:

Over the n1< no < n2 interval. For example, to implement:

We will use the following Matlab function:

n=[0:10];;
x=(0.9).^n;
stem(n,x);
xlabel(‘n’); ylabel(‘x[n]’)

This script yields:

`Geometric series`

A one-side exponential sequence of the form:

Where α is an arbitrary constant. This sequences is called a geometric series.  In DSP, the convergence and expression for the sum of this series are used in many applications. The series converges for:

While this condition is true, the sum of the geometric series components converges to:

From here, we also need an expression for the sum of any finite number of terms of the series, and that is given by:

These two important results will be used deeply throughout DSP.

`Complex-valued exponential sequence`

Where σ produces an attenuation (if<0) or amplification (if>0)  and ωo is the frequency in radians. The Matlab function exp generates the exponential sequences. For example, for x[n] =exp[(2+j3)n], 0n10, we will use the following script:

n=[0:10]; x=exp(3j*n);
stem(n,k)

This script yields:

`Sinusoidal sequence `

Sine waves are important because Fourier´s Theorem states that most signals of practical interest can be decomposed into an infinite sum of sine waves. Discrete-time signals (also called time series) are defined over the set of integers, that is, they are indexed sequences. A discrete-time sine wave is defined by:

Where A is an amplitude and  θo is the phase in radians. Where A is an amplitude and teta is the phase in radians. Meanwhile, ωo=2πf is the angular frequency and x[n] could be written as:

It is important to understand that the frequency of a discrete-time sinusoid is not uniquely defined. This fundamental ambiguity is a consequence of a basic trigonometric property:

In words, the value of a sinusoid does not change if an integer multiple of is added to its argument. Adding the 2πkn to the argument of equation (1) we get:

Two cases must be distinguished. If k≥-f, the equation (2) is equivalent to a sinusoid with frequency f+k with no change in phase:

On the other hand, if k<-f, equation (3) leads to a negative frequency. To avoid this, we introduce:

We also make use of the property:

In consequence, returning to equations (2) and three, we obtain a sinusoid of frequency l-f with a reversal in phase:

In conclusion, a discrete-time sinusoid with frequency f is identical to a same-phase sinusoid of frequency f+k, where k is any integer greater than –f, or to a phase-reversed sinusoid of frequency l-f if l>f.

Equation (3) can be expressed more concisely using complex exponential notation:

Because value of a complex exponential does not change if a multiple of is added to its argument, we get:

Equation (5) is equivalent to equation (4). Because of this fundamental frequency ambiguity, we will often implicitly assume that the angular frequency of a discrete-time sinusoid is restricted to the range –π≤ω≤π, or equivalent, that -1/2≤f≤1/2.

The Matlab function cos or sin generates the sinusoidal sequences. For example, for x[n]=3cos(0.1πn+π/3)+2sin(0.5πn), 0n10, we will use the following script:

n=[0:10]; x=3*cos(0.1*pi*n+pi/3)+2*sin(0.5*pi*n);
stem(n,x)

This script yields:

In construction ….

Source:

• Digital Signal Processing Using Matlab, 3erd ed
• Fundamentos_de_Señales_y_Sistemas_usando la Web y Matlab
• Oppenheim – Señales y Sistemas
• Análisis de Sistemas Lineales Asistido con Scilab – Un Enfoque desde la Ingeniería Eléctrica.

PREVIOUS:

Literature review by:

Prof. Larry Francis Obando – Technical Specialist – Educational Content Writer

Exercises are solved!!

WhatsApp:  +34633129287  Inmediate Attention!!

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, USB Valle de Sartenejas.

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, UCV CCs

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contacto: España. +34633129287

Caracas, Quito, Guayaquil, Jaén.

WhatsApp:  +34633129287