Presentation is loading. Please wait.

Presentation is loading. Please wait.

Department of Computer Science Warwick Univ., UK

Similar presentations


Presentation on theme: "Department of Computer Science Warwick Univ., UK"— Presentation transcript:

1 Department of Computer Science Warwick Univ., UK
DCSP-Revision Jianfeng Feng Department of Computer Science Warwick Univ., UK

2 Any signal x(t) of period T can be represented as the sum of a set of
Fourier Thm. Any signal x(t) of period T can be represented as the sum of a set of cosinusoidal and sinusoidal waves of different frequencies and phases

3 Example I |X(F)| 2/p = Time domain Frequency domain

4 FT in complex exponential
If the periodic signal is replace with an aperiodic signal (general case) FT is given by Is that deadly simple?

5 Information Entropy H(X)= Si P(xi) I(xi) = - Si P(xi) log2 P(xi)
Defined the information contained in an outcome xi in x={x1, x2,…,xn} I(xi) = - log2 p(xi) H(X)= Si P(xi) I(xi) = - Si P(xi) log2 P(xi) Entropy

6 Shannon's first theorem
An instantaneous code can be found that encodes a source of entropy H(X) with an average number Ls (average length) such that Ls >= H(X)

7 Huffman coding Ls = 0.729*1+0.081*3*3+0.009*5*3+0.001* 5
code length Ls = 0.729* *3* *5* * 5 = (remember entropy is 1.4)

8 x [n]: time domain Definition and properties:
The DTFT gives the frequency representation of a discrete time sequence with infinite length. X(w): frequency domain x [n]: time domain

9 DFT III Definition: The discrete Fourier transform (DFT) and its own
inverse DFT (IDFT) associated with a vector X = ( X[0], X[1], … , X[N-1] ) to a vector x = ( x[0], x[1], …, x[N-1] ) of N data points, is given by

10 Mysterious sound Fig. 2 Simple Matlab program is left on slides
clear all close all sampling_rate=100;%Hz omega=30; %signal frequecy Hz N=20000; %total number of samples for i=1:N x_sound(i)=cos(2*pi*omega*i/sampling_rate); %signal x(i)=x_sound(i)+2*randn(1,1); %signal+noise axis(i)=sampling_rate*i/N; % for psd time(i)=i/sampling_rate; % for time trace end subplot(1,2,1) plot(time,x); %signal + noise, time trace xlabel('second') ylabel('x') subplot(1,2,2) plot(axis,abs(fft(x)),'r'); % magnitude of signal xlabel('Hz'); ylabel('Amplitude') sound(x_sound) Fig. 2 Simple Matlab program is left on slides

11 Spectrogram Frequency Time (sec) y=chirp(t,100,1,200,'q'); % Start @
t=0:0.001:2; % 2 1kHz sample rate y=chirp(t,100,1,200,'q'); % 100Hz, cross 200Hz at t=1sec spectrogram(y,128,120,128,1E3); % Display the spectrogram title('Quadratic Chirp: start at 100Hz and cross 200Hz at t=1sec'); sound(y) y=chirp(t,100,1,200,'q'); % Fs=5000; filename = 'h.wav'; audiowrite(filename,y,Fs); Frequency Time (sec)

12 DFT for image DFT for x IDFT for X

13 Example I Original picture Gray scale picture
clear all close all figure(1) I = imread('peppers.png'); imshow(I); K=rgb2gray(I); figure(2) F = fft2(K); figure; imagesc(100*log(1+abs(fftshift(F)))); colormap(gray); title('magnitude spectrum'); figure; imagesc(angle(F)); colormap(gray) Original picture Gray scale picture

14 Example I

15 simple filter design Notice two facts:
The signal has a frequency spectrum within the interval 0 to Fs/2 kHz. The disturbance is at frequency F0 (1.5) kHz. Design and implement a filter that rejects the disturbance without affecting the signal excessively. We will follow three steps:

16 Step 1: Frequency domain specifications
Reject the signal at the frequency of the disturbance. Ideally, we would like to have the following frequency response: where w0=2p (F0/Fs) = p/4 radians, the digital frequency of the disturbance.

17 Step 2: Determine poles and zeros
We need to place two zeros on the unit circle z1 =exp(jw0)=exp(jp/4) and z2=exp(-jw0)=exp(-jp/4) p/4

18 Step 2: Determine poles and zeros
We need to place two zeros on the unit circle z1 =exp(jw0)=exp(jp/4) and z2=exp(-jw0)=exp(-jp/4) If we choose, say K=1, the frequency response is shown in the figure.

19 PSD and Phase As we can see, it rejects the desired frequency
As expected, but greatly distorts the signal

20 Result

21 Recursive Filter A better choice would be to select the poles close to the zeros, within the unit circle, for stability. For example, let the poles be p1= r exp(jw0) and p2= r exp(-jw0). With r =0.95, for example we obtain the transfer function

22 Recursive Filter e= z1 - p1 = (1-r) z1 ~ So we have H(w0) = 0, but close to 1 everywhere else

23 Recursive Filter We choose the overall gain k so that H(z)|z=1=1.
This yields the frequency response function as shown in the figures below.

24 Step 3: Determine the difference equation in the time domain
From the transfer function, the difference equation is determined by inspection: y(n)= x(n) x(n-1) x(n-2) y(n-1) y(n-2) +

25 Step 3: difference equation
Easily implemented as a recursion in a high-level language. The final signal y(n) with the frequency spectrum shown in the following Fig., We notice the absence of the disturbance.

26 Step 3: Outcomes

27 Matched filter Define ai = sN-i (reversing the order)
y(n) = a0 x(n) + a1 x(n-1) + … + aN x(n-N) So when the signal arrives we have y(n) = SN x(n) + SN-1 x(n-1) + … + S1 x(n-N) = SN SN + SN-1 SN-1 + … + S1 S1

28 Wiener Filter The filtered output is given by
Note that the coefficient a depends on the position s is the local variance, Ex2 is the global variance (noise)

29 past papers before the exam


Download ppt "Department of Computer Science Warwick Univ., UK"

Similar presentations


Ads by Google