You are on page 1of 4

Continuous Quality Improvement (CQI)

CLO 1
Problems:-
Solve the following problems in MATLAB Command
Window.
Question # 1.
y[n]=3u[n-1]+4u[n-2]+4ʆ[n+3]

Code.
[x,n]=stepseq(1,-4,6);
[y,n]=stepseq(2,-4,6);
[u,n]=impseq(-3,-4,6);
y1 = 3*x+4*y+4*u;
stem(n,y1,'r');
xlabel('time index n');
ylabel('Amplitude');
title('1');

Matlab Code.

1
Output:

Question # 2.
y[n]=3ʆ[n+2]*2ʆ[n+2]+3u[n-1]*4u[n-2]-4u[n-10]

Code.
[w,n]=impseq(-2,-4,12);
[x,n]=impseq(-2,-4,12);
[y,n]=stepseq(1,-4,12);
[z,n]=stepseq(2,-4,12);
[a,n]=stepseq(10,-4,12);

y2 = (3*w).*(2*x)+(3*y).*(4*z)-(4*a);
stem(n,y2,'r');
xlabel('time index n');
ylabel('Amplitude');
title('2');
grid on

2
Matlab Code.

Output:

3
Question # 3.
All functions used in previous questions
Matlab Code.

Impulse Sequence.
function [x,n] = impseq(n0,n1,n2)
% Generates x(n) = delta(n-nO); n1 <= n <= n2
% ---------------------------------------------¬
% [x,n] = impseq(n0,n1,n2)
%
n= [n1:n2];
x = [(n-n0) == 0];

Step Sequence.
function [x,n] = stepseq(n0,n1,n2)
% Generates x(n)= u(n-nO); n1 <= n <= n2
%---------------------------------------------------------------
% [x,n] = stepseq(n0,n1,n2)
%
n = [n1:n2];
x = [(n-n0) >= 0];

You might also like