0% found this document useful (0 votes)
39 views6 pages

MatLab Representations of Discrete-Time Signals PDF

The document discusses using MATLAB to represent various types of discrete-time signals including unit sample signals, unit step signals, unit ramp signals, real and complex exponential signals, sinusoidal signals, and signal addition. It provides MATLAB code examples to generate and plot these signals. It also discusses shifting and folding discrete-time signals in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views6 pages

MatLab Representations of Discrete-Time Signals PDF

The document discusses using MATLAB to represent various types of discrete-time signals including unit sample signals, unit step signals, unit ramp signals, real and complex exponential signals, sinusoidal signals, and signal addition. It provides MATLAB code examples to generate and plot these signals. It also discusses shifting and folding discrete-time signals in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

26/07/2015

MathLabExample:

MatLabrepresentationsofDiscretetimeSignals

1.Unitsamplesignal

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

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

2.Unitstepsignal

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

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

1/6

26/07/2015

MathLabExample:

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

3.Unitrampsignal

>>n=5:5
>>x=n.*
[n>=0]
>>stem(n,x)

>>n=5:5
>>x=(n2).*[(n
2)>=0]
>>stem(n,x)

4.Realvaluedexponentialsignal

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

2/6

26/07/2015

MathLabExample:

>>n=20:20
>>x=(0.9.^n).*
[n>=0]
>>stem(n,x)

>>n=20:20
>>x=(0.9.^(n3)).*[(n
3)>=0]
>>stem(n,x)

5.Complexvaluedexponentialsignal

forn>=0

>>n=5:40
>>x=(exp((3*4j)*n)).*[n>=0]
>>y=real(x)
>>subplot(2,1,1)
>>stem(n,y)
>>z=imag(x)
>>subplot(2,1,2)
>>stem(n,z)

6.Sinusoidalsignal:

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

3/6

26/07/2015

MathLabExample:

>>n=5:40
>>x=4*cos(0.1*pi*n+pi/3)
>>stem(n,x)

>>stem(n,x)
>>x=4*cos(0.1*pi*n+pi/3)+3*sin(0.3*pi*n+pi)
>>stem(n,x)

SignalAddition:

n1=0:4
x1=[01234]
n2=2:2
x2=[22222]
n=min(min(n1),min(n2)):max(max(n1),max(n2))%durationofy(n)
y1=zeros(1,length(n))y2=y1%initialization
y1(find((n>=min(n1))&(n<=max(n1))==1))=x1%x1withdurationofy
y2(find((n>=min(n2))&(n<=max(n2))==1))=x2%x2withdurationofy
y=y1+y2%sequence
addition%addition
stem(n,y)

wecanrepresent

,and

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

signalsasfollow.

4/6

26/07/2015

MathLabExample:

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

5/6

26/07/2015

MathLabExample:

Shiftinganonfunctiondiscretetimesignal

%ShiftinganonfunctionDiscretetime
signal
n=0:8
x=[015213645]
subplot(2,1,1)stem(n,x)title('x(n)
mfile
signal')
xlabel('n')ylabel('x(n)')

m=n+2y=x
subplot(2,1,2)stem(m,y)title('y(n)=x(n
2)signal')
xlabel('n')ylabel('y(n)')

FoldingaDiscretetimesignal

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

6/6

You might also like