1.1.7
f(n) = u(n)-n(n-4)
n = -5:5; f = (n >= 0); g = (n >= 4); stem (n,(f-g))
g(n)=r(n)-2r(n-5)+r(n-10)
n = -15:15; r = n.*(n >= 0); f = (n-5).*((n-5)>=0); h = (n-10).*((n-10)>=0); g = r - 2.*f + h; stem (n,g)
x(n) = δ(n) - 2δ(n-4)
n = -5:5; f = (n == 0); g = ((n-4)==0); x = f - 2.*g stem (n,x)
y(n) = (0.9)^n (u(n)-u(n-20))
n = -20:20; f = (n >= 0); g = ((n-20)>=0); y = 0.9.^n.*(f-g); stem (n,y)
v(n) = cos (0.12pi*n)u(n)
n = 0:40; f = cos(.12*pi*n) g = (n>=0); y = f.*g; stem (n,y)
1.3.8
The convmtx() function work like this:
For example, h =[1,3,-1,2]; convmtx(h',4) It use the basic principle of convolution. When this matrix multiple x’, every line of this matrix multiple x’ and finally add together.
1.3.9 f = (n>=0)-((n-5)>=0); g = n.*(n >= 0)-2.*(n-5).*(n >= 0)+(n-10).*((n-10) >= 0);
A f(n)*f(n)
B f(n)*f(n)*f(n)
C f(n)*g(n)
D g(n)*delta(n) Every signal convolve delta signal is it self.
E g(n) * g(n)
From the figure, we know that f(n)*f(n) is a shift of g(n).
The signal is amplified when the signal convolved to itself repeatedly.
1.3.10
Command:
n = -5:5 f = 3.*((n+2)==0)-((n-1)==0)+2.*((n-3)==0) g = ((n+4)>=0)-((n-3)>=0) y = conv(f,g) m = -10:10 stem (m,y); xlabel('n'); ylabel('y(n)')
14.1
1.5.1 b
Program: Plot:
n = -10:10; k = -20:20; h = -(n == 0)+2*(1/2).^n.*(n>= 0); inverse = -(n == 0)+2*(-1/2).^n.*(n>= 0); v = conv (h,inverse); stem (k,v)
1.5.2 c
Program: Plot:
n = -10:10; k = -20:20; h = (n ==0) + 3.5 * ((n-1)==0)+ 1.5 *((n-2) == 0); inverse = -0.2*(-1/2).^n.*(n>= 0) - 1.2 * (-3).^n .*((-n-1)>=0); v = conv (h,inverse); stem (k,v)
1.5.3 b
Program: Plot:
n = -10:10; k = -20:20 h = ((n+1) ==0) - 10/3 * (n==0)+ ((n-1) == 0)