# Discrete-Time Signals and Systems

• Watch video entitled “Module 6 –  Discrete-Time Signals in MATLAB”
• Work the lab air underneath using MATLAB.
• Include answers for Problems and understand MATLAB coding along delay any output batchs that patronage separations into a Word muniment entitled “Lab6_StudentID”.  Where your learner id is substituted in the polish designate.

Activity 1:

A discrete-period direct can be described in one of two ways.  One is by the ace-pulse vindication of the direct, and the other is by the dissimilarity equation.  In the highest event, if we are fond an input and neglect to experience the output, we entertain to weave the direct vindication delay the input saline.  In the relieve event, we entertain to clear-up the dissimilarity equation for the output when the input saline is substituted into the dissimilarity equation.  The upshot should be the selfselfselfsame no subject what arrival is used.

A discrete-period direct has the aftercited ace-pulse vindication: for Correspondingly, the aftercited dissimilarity equation describes the action of the direct: • Use the Matlab charge conv to apportion the vindication of the direct to a ace stride input, x[n]=u[n].  Revolve .  Show what you expression into the Matlab charge window.  Also, resign a batch of the output.  Be indisputable to engrave your axes.

Matlab Tip:  Remember that you can amply get acceleration on a charge in Matlab by typing acceleration delay the charge at the apt:

EDU>>acceleration conv

Matlab Tip:  Also, don't obliviate that in Matlab when you do unfailing operations on an marshal part-by-element, you must herald the operator delay a end.  For precedence, in Matlab, if you determine an marshal n as follows:

EDU>>n=[0:20];

then the highest account of the ace-pulse vindication is written as 0.5.^n

Matlab Tip:  Sometimes it is beneficial to perceive the bulk of marshals you entertain created.  This can be executed in separate ways.  For in, you can use the charge bulk:

EDU>> bulk(n)

ans =

1    21

The bulk of the marshal is returned.  In this event, the marshal n has a bulk of 1 row by 21 columns.

Alternatively, you can switch the exhibit from the Prevalent Directory to the Workspace.  Then all prevalent variables and marshals and their bulks are exhibited.  Just click on Workspace in the surpassing left cavity as indicated underneath. • Use the Matlab duty resort to apportion the vindication of the direct to a ace stride input, x[n]=u[n].  Again revolve .  Show all that you expression into the Matlab charge window.  Resign a batch of the output delay the axes engraveed.

The Matlab duty resort is not a duty which comes delay Matlab or any of the toolboxes you entertain installed.  Instead, it is a that must be acquired to your Matlab directory.

The Matlab duty resort can be set-up in a zip polish at the Mathworks residence at the aftercited location:

Extract the polish resort.m to the prevalent directory shown at the top of the Matlab window.

On the other influence, you can portraiture and paste the script underneath into a quotation polish relish Notepad and snatch it as resort.m in the prevalent directory shown at the top of the Matlab window.

duty y = resort(a,b,n,x,x0,y0);

%

% y = resort(a,b,n,x,x0,y0)

%  clear-ups for y[n] from:

% y[n] + a1*y[n-1] + a2*y[n-2]... + an*y[n-N]

%   =  b0*x[n] + b1*x[n-1] + ... + bm*x[n-M]

%

% a, b, n, x, x0 and y0 are vectors

% a = [a1 a2 ... aN]

% b = [b0 b1 ... bM]

% n contains the period values for which the separation allure be computed

% y0 contains the primal conditions for y, in direct,

%    i.e., y0 = [y[n0-N], y[n0-N+1], ...,y[n0-1]]

%    where n0 represents the highest part of n

% x0 contains the primal conditions on x, in direct

%    i.e., x0 = [x[n0-M],...,x[n0-1]]

% the output, y, has protraction(n)

%

N = protraction(a);

M = protraction(b)-1;

if protraction(y0) ~= N,

mistake('Lengths of a and y0 must pair')

end

if protraction(x0) ~= M,

mistake('Length of x0 must pair protraction of b-1')

end

y = [y0 zeros(1,length(n))];

x = [x0 x];

a1 = a(length(a):-1:1);             % reverses the parts in a

b1 = b(length(b):-1:1);

for i=N+1:N+length(n),

y(i) = -a1*y(i-N:i-1)' + b1*x(i-N:i-N+M)';

end

y = y(N+1:N+length(n));

To get advice on how to use the duty, at the Matlab apt, expression:

EDU>>acceleration resort

It potentiality be accelerationful to diversify the protest of the dissimilarity equation such that the highest protest is n rather than n+2.

• Are your batchs the selfsame?  If not, why not?