190 likes | 404 Views
ENTC 4337. Sine Generation. Z-Transform Table. ?. Digital Oscillator Design. Impulse Response h(n)=sin( w nt). Impulse x(n)={1,0,0,...,0}.
E N D
ENTC 4337 Sine Generation
? Digital Oscillator Design Impulse Response h(n)=sin(wnt) Impulse x(n)={1,0,0,...,0}
Design a digital filter that generates an 800 Hz sine wave in response to an impulse. Sampling frequency is 10,000 Hz. Test the filter by observing the first 10 output samples. Hint: Use the Z-transform table and convert H(z) to a difference equation.
Types of Sequences Impulse function [x,n]=impseq(n0,n1,n2) %Generates x(n)=delta(n-n0); n1<=n<=n2 %------------------------------------- %[x,n]=impseq(n0,n1,n2) % n=[n1:n2]; x=[(n-n0)==0]; >>[x,n]=impseq(0,-3,9); >>stem(n,x); grid >>axis([0 10 0 2])
Sinusoidal Sequence » n=[0:9]; » h=sin(0.503*n); » stem(n,h),grid
Convolution » [x,n]=impseq(0,-3,9); » h=sin(0.503*n); » y=conv(x,h) y = Columns 1 through 7 0 0 0 -0.9981 -0.8447 -0.4821 0 Columns 8 through 14 0.4821 0.8447 0.9981 0.9042 0.5864 0.1233 -0.3704 Columns 15 through 21 -0.7723 -0.9829 0 0 0 0 0 Columns 22 through 25 0 0 0 0
yHAND={0,0.4821,0.8443,0.9980,0.9048,0.5878,0.1253,-0.3681,-0.7705,-0.9823}yHAND={0,0.4821,0.8443,0.9980,0.9048,0.5878,0.1253,-0.3681,-0.7705,-0.9823} yMATLAB={0,0.4821,0.8447,0.9981,0.9042,0.5864,0.1233,-0.3704,-0.7723,-0.9829}
Design a digital filter that generates an 1000 Hz sine wave in response to an impulse. Sampling frequency is 10,000 Hz. Test the filter by observing the first 10 output samples. Hint: Use the Z-transform table and convert H(z) to a difference equation.
MATLAB Implementation >> [x,n]=impseq(0,-3,25); >> h=sin(0.628*n); >> y=conv(x,h); >> t=[-6:1:length(y)-7]; >> stem(t,y),grid
Note that 1 period is 10 samples and that 10 X .0001 seconds is 1 ms, or a frequency of 1 kHz.