0% found this document useful (0 votes)
47 views

Matlab Representations of Discrete-Time Signals: 1. Unit Sample Signal

This document provides examples of representing discrete-time signals in MATLAB. It demonstrates unit step signals, unit ramp signals, real and complex exponential signals, sinusoidal signals, adding signals, shifting signals, and folding signals. MATLAB code is included with each example to generate and plot the signals.

Uploaded by

rajendrasoloni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Matlab Representations of Discrete-Time Signals: 1. Unit Sample Signal

This document provides examples of representing discrete-time signals in MATLAB. It demonstrates unit step signals, unit ramp signals, real and complex exponential signals, sinusoidal signals, adding signals, shifting signals, and folding signals. MATLAB code is included with each example to generate and plot the signals.

Uploaded by

rajendrasoloni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Math-Lab Example:

1 of 7

http://www.csupomona.edu/~zaliyazici/ece308/MatLab.html

n1 = 0:4;
MatLab representations of Discrete-time Signals
x1 = [0 1 2 3 4];
>> %Shifting
n=-5:40; a non-function Discrete-time
signal
n2 = -2:2;
>>
x=(exp((3*4j)*n)).*[n>=0];
1.x2
Unit
signal
n = 0:8;
= sample
[2 2 2 2
2];
>> >>
stem(n,x)
y=real(x);
x
[0y(n)
1 5 2 1 3 6 4 5];
n = min(min(n1),min(n2)):max(max(n1),max(n2)); >>
% duration
n=-5:40;
>>=ofn=-5:5;
>> >>
x=4*cos(0.1*pi*n+pi/3)+3*sin(0.3*pi*n+pi);
subplot(2,1,1);
subplot(2,1,1);stem(n,x);
title('x(n)
y1 = zeros(1,length(n)); y2 = y1;
% initialization
>>
x=4*cos(0.1*pi*n+pi/3);
>>
x=[(n-2)>=0];
x=(n-2).*[(n-2)>=0];
>>with
stem(n,x)
>>
n=-20:20;
>>
stem
(n,y)
n=-5:5;
signal');
y1(find((n>=min(n1))&(n<=max(n1))==1))=x1;
% x1
duration
of y
>>
stem(n,x)
>>
stem
(n,x)
m-file
>>>>
n=-20:20;
x=(0.9.^(n-3)).*[(n-3)>=0];
>> xlabel('n');
z=imag(x);
x=n.*[n>=0];
y2(find((n>=min(n2))&(n<=max(n2))==1))=x2;
% x2 with
duration
of ylabel('x(n)');
y
>>>>x=(0.9.^n).*[n>=0];
stem
(n,x)
>> subplot(2,1,2);
y = y1+y2;
% sequence
addition
>> m=n+2;
stem (n,x)
y=x;
% addition
>> stem (n,z)
subplot(2,1,2);stem(m,y); title('y(n)=x(n-2)
stem(n,y)
signal');
xlabel('n'); ylabel('y(n)');

>> n=-5:5;
>> x=[n==0];
>> stem (n,x)

>> n=-5:5;
>> x=[(n-2)==0];
>> stem (n,x)

2. Unit step signal

>> n=-5:5;
>> x=[n>=0];
>> stem (n,x)

7/23/2014 10:36 PM

Math-Lab Example:

2 of 7

http://www.csupomona.edu/~zaliyazici/ece308/MatLab.html

3. Unit ramp signal

4. Real valued exponential signal

7/23/2014 10:36 PM

Math-Lab Example:

3 of 7

http://www.csupomona.edu/~zaliyazici/ece308/MatLab.html

5. Complex-valued exponential signal


for n>=0

6. Sinusoidal signal:

7/23/2014 10:36 PM

Math-Lab Example:

4 of 7

http://www.csupomona.edu/~zaliyazici/ece308/MatLab.html

Signal Addition:

we can represent

, and

signals as follow.

7/23/2014 10:36 PM

Math-Lab Example:

5 of 7

http://www.csupomona.edu/~zaliyazici/ece308/MatLab.html

7/23/2014 10:36 PM

Math-Lab Example:

6 of 7

http://www.csupomona.edu/~zaliyazici/ece308/MatLab.html

Shifting a non-function discrete-time signal

Folding a Discrete-time signal

7/23/2014 10:36 PM

Math-Lab Example:

7 of 7

http://www.csupomona.edu/~zaliyazici/ece308/MatLab.html

7/23/2014 10:36 PM

You might also like