Professional Documents
Culture Documents
ECE107L/E04
Syntax:
>> x = [-2 4 -1 -3 5 8 2 -5];
>> t = 0: length(x)-1;
>> stem(-(t-3),x,'m-<');
c. X(-n+3)
Syntax:
>> x = [-2 4 -1 -3 5 8 2 -5];
>> t = 0: length(x)-1;
>> stem(-(t-3)+3,x,'m-<');
d. 3X(n+4)
Syntax:
>> x = [-2 4 -1 -3 5 8 2 -5];
>> t = 0: length(x)-1;
>> stem((t-3)+4,3*x,'m-<');
e. -2X(n-3)
Syntax:
>> x = [-2 4 -1 -3 5 8 2 -5];
>> t = 0: length(x)-1;
>> stem((t-3)-3,-2*x,'m-<');
f. X(3n+2)
Syntax:
>> x = [-2 4 -1 -3 5 8 2 -5];
>> t = 0: length(x)-1;
>> stem(3*(t-3)+2,x,'m-<');
g. 4X(3n-2)
Syntax:
>> x = [-2 4 -1 -3 5 8 2 -5];
>> t = 0: length(x)-1;
>> stem(3*(t-3)-2,4*x,'m-<');
2. Plot the signals x(n) and h(n). Determine the value for y(n) which is equivalent to convolve
signals x(n) and h(n) and display resulting waveform
3. Solve the roots of the following equation
a. 3x2 + 3x + 2 = 0
Syntax:
>> p = [3 3 2];
>> r = roots(p)
r=
-0.5000 + 0.6455i
-0.5000 - 0.6455i
b. 4x4 - 9 x3 + 8x – 10 = 0
Syntax:
>> p = [4 -9 8 -10];
>> r = roots(p)
r=
1.8914 + 0.0000i
0.1793 + 1.1356i
0.1793 - 1.1356i
4. Find the polynomial expression given the following factors
a. (x + 5)(x + 3) (x + 5)(x +3)
Syntax:
>> r = [-5 -3 -5 -3];
>> p2 = poly(r)
p2 =
1 16 94 240 225
b. (x - 4)(x - 3)(x - 5)(x + 2)
Syntax:
>> r = [4 3 5 -2];
>> p2 = poly(r)
p2 =
1 -10 23 34 -120
5. Expand the expression below using partial fraction expansion
a. (4s3 + 2s2 – s + 3)/(s-3)(s+2)(s-1)
Syntax:
>> r = [3 -2 1];
>> p2 = poly(r);
>> p1 = [4 2 -1 3];
>> [r,p,k] = residue(p1,p2)
r=
12.6000
-1.2667
-1.3333
p=
3.0000
-2.0000
1.0000
k=
4
b. Now, convert the partial fraction expansion back to polynomial coefficients. What did you
obtain? Is this similar to your original signal?
Syntax:
p1 =
p2 =
>> r = roots(p2)
r=
-2.0000
3.0000
1.0000
6.
a. Using your microphone record a 5-second audio saying “Digital Signal Processing” with
sampling frequency of 11025Hz.
Syntax:
>> Guanzing = audiorecorder(11025,16,1);
>> recordblocking(Guanzing, 5);
>> play(Guanzing)
ans =
SampleRate: 11025
BitsPerSample: 16
NumberOfChannels: 1
DeviceID: -1
CurrentSample: 257
TotalSamples: 55125
Running: 'on'
StartFcn: []
StopFcn: []
TimerFcn: []
TimerPeriod: 0.0500
Tag: ''
UserData: []
Type: 'audioplayer'
7. Create a lowpass FIR filter with 6th order filter, cutoff frequency of 2000 Hz and sampling
frequency of 11025Hz. Determine the filter coefficients. Plot the poles and zeroes of the filter,
its impulse response, and its frequency response.
Syntax:
>> [b,a] = fir1(6,2*2000/11025)
Pole-Zero Plot
Syntax:
>>pz = zplane(b,a,'m');
Impulse Response Graph
Syntax:
>> [H,T]=impz(b,a);
>> stem(T,H,'m<')
c. Filter your original signal using lowpass filter created earliler. Plot the frequency content
of the filtered signal. Describe the waveform.
Syntax:
>> FS = 11025;
>> LF = filter(b,a,y);
>> fftLow = fft(LF,512);
>> w = (0:255)/256*(FS/2);
>> plot(w,abs(fftLow(1:256)),'m');
d. Play audio signal and describe what you hear.
8. Generate a high pass 6th order FIR filter with a cutoff frequency of 1000 Hz. Plot the poles and
zeroes of the filter, its impulse response, and magnitude response. Provide filter coefficients.
Syntax:
>> FS = 11025;
>> FC = 1000;
>> i = FC/(FS/2);
>> [b,a] = fir1(6,i,'high')
Pole-Zero Plot
Syntax:
pz = zplane(b,a,'m');
Impulse Response Graph
Syntax:
>> [H,T]=impz(b,a);
>> stem(T,H,'m<')
9. Generate bandpass FIR filter with 30th filter oder, cutoff frequencies of 2.5 kHz and 3kHz. Plot
the poles and zeroes of the filter and magnitude response.
Syntax:
>> [b,a] = fir1(30,2*[2500 3000]/11025)
b = -0.0002 -0.0057 0.0004 0.0135 -0.0008 -0.0299 0.0013 0.0545 -0.0017 -0.0837
0.0017 0.1115 -0.0013 -0.1316 0.0005 0.1390 0.0005 -0.1316 -0.0013 0.1115
0.0017 -0.0837 -0.0017 0.0545 0.0013 -0.0299 -0.0008 0.0135 0.0004 -0.0057 -
0.0002
a= 1
Pole-Zero Plot
Syntax:
pz = zplane(b,a,'m');
Impulse Response Graph
Syntax:
>> [H,T]=impz(b,a);
>> stem(T,H,'m<')
10. Generate a stop band FIR filter order, cutoff frequency of 1.5k Hz and 3k Hz, plot the poles and
zeroes of the filter, its impulse response the its frequency response.
Syntax:
>> [b,a] = fir1(30,2*[1500 3000]/11025,'stop')
b = -0.0004 0.0008 -0.0022 -0.0077 0.0004 0.0173 0.0095 -0.0072 0.0072 -0.0063 -
0.0822 -0.0542 0.1415 0.1936 -0.0744 0.7290 -0.0744 0.1936 0.1415 -0.0542 -
0.0822 -0.0063 0.0072 -0.0072 0.0095 0.0173 0.0004 -0.0077 -0.0022 0.0008 -
0.0004
a= 1
Pole-Zero Plot
Syntax:
pz = zplane(b,a,'m');
Impulse Response Graph
Syntax:
>> [H,T]=impz(b,a);
>> stem(T,H,'m<')