Title: n0:3
1gtgt n03 n 0 1 2 3 gtgt
mod(n-2,4) ans 2 3 0 1 gtgt
x14 x 1 2 3 4 gtgt
x(mod(n-2,4)1) ans 3 4 1 2
2gtgt n010 x10(0.8).n gtgt yx(mod(-n,11)1) gt
gt subplot(2,1,1)stem(n,x) axis(-1 11 0
11)title('Original sequence') gtgt
subplot(2,1,2)stem(n,y) axis(-1 11 0
11)title('Circularly folded sequence')
3gtgt Xdft(x',11)Ydft(y',11) gtgt
subplot(2,2,1)stem(n,real(X))title('RealDFTx(n
)') gtgt subplot(2,2,2)stem(n,imag(X))title('Im
agDFTx(n)') gtgt subplot(2,2,3)stem(n,real(Y))
title('realDFTx((-n))11') gtgt
subplot(2,2,4)stem(n,imag(Y))title('imagDFTx((
-n))11')
4function xec, xoccircevod(x) real-value
signal decomposition into circular-even and
circular-odd parts if any(imag(x)0)
error('x is not a real sequence') end
Nlength(x) n0(N-1) xec0.5(xx(mod(-n,N)1)
) xoc0.5(x-x(mod(-n,N)1))
5gtgt n010 x10(0.8).n gtgt xec,xoccircevod(x)
gtgt subplot(2,1,1) stem(n,xec)title('Circular-e
ven component') gtgt subplot(2,1,2)
stem(n,xoc)title('Circular-odd component')
6gtgt Xdft(x',11) Xecdft(xec',11)Xocdft(xoc',11)
gtgt Xec Xec 45.7050 10.1671
0.0000i 6.2575 0.0000i 5.4515
5.1827 - 0.0000i 5.0887 - 0.0000i 5.0887 -
0.0000i 5.1827 - 0.0000i 5.4515 - 0.0000i
6.2575 - 0.0000i 10.1671 - 0.0000i
gtgt Xoc Xoc -0.0000 0.0000
-13.4479i 0.0000 - 6.8202i 0.0000 -
3.8755i 0.0000 - 2.0562i 0.0000 - 0.6489i
0.0000 0.6489i 0.0000 2.0562i -0.0000
3.8755i -0.0000 6.8202i -0.0000 13.4479i
7gtgt subplot(2,2,1)stem(n,real(X))title('RealDFT
x(n)') gtgt subplot(2,2,2)stem(n,imag(X))title('
ImagDFTx(n)') gtgt subplot(2,2,3)stem(n,real(Xe
c))title('DFTxec(n)') gtgt subplot(2,2,4)stem(n,
imag(Xoc))title('ImagDFTxoc(n)')
8gtgt n010 x10(0.8).n ycirshift(x,6,15) gtgt
n014 xx,zeros(1,4) gtgt subplot(2,1,1)
stem(n,x)title('x(n)') gtgt subplot(2,1,2)
stem(n,y)title('x((n-6))15')
9gtgt Xdft(x',15) gtgt wnexp(-j2pi/15) gtgt
wn.(6014').X ans 45.7050
-22.6391 7.9023i 13.4175 5.1388i -3.4939
- 8.4318i -1.8380 6.6090i 5.7729 -
3.3882i -5.7632 - 2.4191i 1.7576 4.9755i
1.7576 - 4.9755i -5.7632 2.4191i 5.7729
3.3882i -1.8380 - 6.6090i -3.4939 8.4318i
13.4175 - 5.1388i -22.6391 - 7.9023i
gtgt Ydft(y',15) Y 45.7050
-22.6391 7.9023i 13.4175 5.1388i -3.4939
- 8.4318i -1.8380 6.6090i 5.7729 -
3.3882i -5.7632 - 2.4191i 1.7576 4.9755i
1.7576 - 4.9755i -5.7632 2.4191i 5.7729
3.3882i -1.8380 - 6.6090i -3.4939 8.4318i
13.4175 - 5.1388i -22.6391 - 7.9023i
10gtgt n010 x10(0.8).n gtgt wnexp(-j2pi/11)df
t(wn.(-4(010)').x',11) ans 5.1827
2.0562i 5.4515 3.8755i 6.2575 6.8202i
10.1671 13.4479i 45.7050 0.0000i 10.1671
-13.4479i 6.2575 - 6.8202i 5.4515 -
3.8755i 5.1827 - 2.0562i 5.0887 - 0.6489i
5.0887 0.6489i
gtgtXdft(x',11)cirshift(X,4,11) ans 5.1827
2.0562i 5.4515 3.8755i 6.2575
6.8202i 10.1671 13.4479i 45.7050
10.1671 -13.4479i 6.2575 - 6.8202i 5.4515 -
3.8755i 5.1827 - 2.0562i 5.0887 - 0.6489i
5.0887 0.6489i
11function ycirshift(x,m,N) circular shift
y(n)x((n-m)mod N) if length(x)gtN error('N
must be gt the length of x') end xx zeros(1,
N-length(x)) n01N-1 nmod(n-m,N)
yx(n1)
12gtgt x11 2 2 0X1dft(x1',4) gtgt x21 2 3
4X2dft(x2',4) gtgt idft(X1.X2,4) ans
15.0000 0.0000i 12.0000 0.0000i 9.0000 -
0.0000i 14.0000 - 0.0000i
13function ycirconvt(x1,x2,N) N-point circular
convolution between x1 and x2 (time domain) if
length(x1)gtN error('N must be gt the length
of x1') end if length(x2)gtN error('N must
be gt the length of x2') end x1x1
zeros(1,N-length(x1)) x2x2 zeros(1,N-length(x2
)) m01N-1 x2x2(mod(-m,N)1) circular
folding Hzeros(N,N) for n11N,
H(n,)cirshift(x2,n-1,N) end yHx1'
14gtgt x11 2 2 x21 2 3 4 gtgt ycirconvt(x1,x2,4)
y 15 12 9 14