Distortion of filtered signals MATLAB tutorial series (Part 3.2) - - PowerPoint PPT Presentation

β–Ά
distortion of filtered signals
SMART_READER_LITE
LIVE PREVIEW

Distortion of filtered signals MATLAB tutorial series (Part 3.2) - - PowerPoint PPT Presentation

Distortion of filtered signals MATLAB tutorial series (Part 3.2) Pouyan Ebrahimbabaie Laboratory for Signal and Image Exploitation (INTELSIG) Dept. of Electrical Engineering and Computer Science University of Lige Lige, Belgium Applied


slide-1
SLIDE 1

Distortion of filtered signals

Pouyan Ebrahimbabaie Laboratory for Signal and Image Exploitation (INTELSIG)

  • Dept. of Electrical Engineering and Computer Science

University of Liège Liège, Belgium Applied digital signal processing (ELEN0071-1) 8 April 2019

MATLAB tutorial series (Part 3.2)

slide-2
SLIDE 2

2

Distortionless response system A system has distortionless response if the input signal π’š[𝒐] and the output signal 𝒛[𝒐] have the same shape.

slide-3
SLIDE 3

3

Distortionless response system A system has distortionless response if the input signal π’š[𝒐] and the output signal 𝒛[𝒐] have the same shape. It means:

𝒛 𝒐 = π‘―π’š 𝒐 βˆ’ 𝒐𝒆 𝑯, 𝒐𝒆: constant

slide-4
SLIDE 4

4

Distortionless response system A system has distortionless response if the input signal π’š[𝒐] and the output signal 𝒛[𝒐] have the same shape. It means:

𝒁 π’‡π’Œπ = π‘―π’‡βˆ’π’Œππ’π’†π’€ π’‡π’Œπ ,

slide-5
SLIDE 5

5

Distortionless response system A system has distortionless response if the input signal π’š[𝒐] and the output signal 𝒛[𝒐] have the same shape. It means:

𝒁 π’‡π’Œπ = π‘―π’‡βˆ’π’Œππ’π’†π’€ π’‡π’Œπ , 𝑰 π’‡π’Œπ = 𝒁 π’‡π’Œπ 𝒀 π’‡π’Œπ = π‘―π’‡βˆ’π’Œππ’π’†

slide-6
SLIDE 6

6

Distortionless response system A system has distortionless response if the input signal π’š[𝒐] and the output signal 𝒛[𝒐] have the same shape. It means:

𝑰 π’‡π’Œπ = 𝑯, βˆ π‘° π’‡π’Œπ = βˆ’π’π’†π.

slide-7
SLIDE 7

7

Distortionless response system A system has distortionless response if the input signal π’š[𝒐] and the output signal 𝒛[𝒐] have the same shape. It means:

𝑰 π’‡π’Œπ = 𝑯, βˆ π‘° π’‡π’Œπ = βˆ’π’π’†π.

Notice: phase response passes from the origin !

slide-8
SLIDE 8

8

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

slide-9
SLIDE 9

9

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

𝒛𝒋 𝒐 = π’…πŸππ©π­(ππŸπ’ + 𝝌𝟐) + π’…πŸ‘ 𝐝𝐩𝐭 πŸ’ππŸπ’ + πŒπŸ‘ +π’…πŸ’ 𝐝𝐩𝐭(πŸ”ππŸπ’ + πŒπŸ’).

slide-10
SLIDE 10

10

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

π’›πŸ 𝒐 = 𝟐𝐝𝐩𝐭(ππŸπ’ + 𝟏) βˆ’ 𝟐/πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟏 +𝟐/πŸ” 𝐝𝐩𝐭(πŸ”ππŸπ’ + 𝟏). Original signal no change !

slide-11
SLIDE 11

11

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

π’›πŸ 𝒐 = 𝟐/πŸ“ππ©π­(ππŸπ’ + 𝟏) βˆ’ 𝟐/πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟏 +𝟐/πŸ” 𝐝𝐩𝐭(πŸ”ππŸπ’ + 𝟏). High pass filter Low frequency attenuated !

slide-12
SLIDE 12

12

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

π’›πŸ‘ 𝒐 = 𝐝𝐩𝐭(ππŸπ’ + 𝟏) βˆ’ 𝟐/πŸ• 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟏 +𝟐/𝟐𝟏 𝐝𝐩𝐭(πŸ”ππŸπ’ + 𝟏). Low pass filter High frequencies attenuated !

slide-13
SLIDE 13

13

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

π’›πŸ’ 𝒐 = 𝐝𝐩𝐭(ππŸπ’ + 𝝆/πŸ•) βˆ’ 𝟐/πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝝆/πŸ• +𝟐/πŸ” 𝐝𝐩𝐭(πŸ”ππŸπ’ + 𝝆/πŸ•). Constant phase

slide-14
SLIDE 14

14

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

π’›πŸ“ 𝒐 = 𝐝𝐩𝐭(ππŸπ’ βˆ’ 𝝆/πŸ“) βˆ’ 𝟐/πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ βˆ’ πŸ’π†/πŸ“ +𝟐/πŸ” 𝐝𝐩𝐭(πŸ”ππŸπ’ βˆ’ πŸ”π†/πŸ“). Linear phase

slide-15
SLIDE 15

15

Example (pp. 216-218) π’š 𝒐 = 𝐝𝐩𝐭(ππŸπ’) βˆ’

𝟐 πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝟐 πŸ” 𝐝𝐩𝐭 πŸ”ππŸπ’ ,

π’›πŸ” 𝒐 = 𝐝𝐩𝐭(ππŸπ’ βˆ’ 𝝆/πŸ’) βˆ’ 𝟐/πŸ’ 𝐝𝐩𝐭 πŸ’ππŸπ’ + 𝝆/πŸ“ +𝟐/πŸ” 𝐝𝐩𝐭(πŸ”ππŸπ’ + 𝝆/πŸ–). Nonlinear phase

slide-16
SLIDE 16

16

Example (pp. 216-218)

slide-17
SLIDE 17

17

Example (pp. 216-218)

slide-18
SLIDE 18

18

FIR has one main advantage and many disadvantages rather IIR …

slide-19
SLIDE 19

19

FIR has linear phase response !

slide-20
SLIDE 20

20

FIR filters are the best choice to remove the noises from signal without distortion.

slide-21
SLIDE 21

21

Example

Original signal Time Signal

slide-22
SLIDE 22

22

Example

Signal plus noise v.s. Original signal Time Signal

slide-23
SLIDE 23

23

Example

Signal plus noise v.s. Original signal Time Signal Noise source is known : 12-18 Hz

slide-24
SLIDE 24

24

Example

Single sided Fourier transform Frequency (Hz) Magnitude response Noise source is known : 12-18 Hz

slide-25
SLIDE 25

25

Example

Single sided Fourier transform Frequency (Hz) Magnitude response Noise source is known : 12-18 Hz

slide-26
SLIDE 26

26

Example

Bandstop

slide-27
SLIDE 27

27

Example

IIR

slide-28
SLIDE 28

28

Example

Hz

slide-29
SLIDE 29

29

Example

Sampling frequency

slide-30
SLIDE 30

30

Example

12-18 Hz

slide-31
SLIDE 31

31

Example

60 dB attenuation at stop band

slide-32
SLIDE 32

32

Example

Magnitude response

slide-33
SLIDE 33

33

Example

Order 68

slide-34
SLIDE 34

34

Example

Filtered signal using IIR Butterworth filter Time Signal

slide-35
SLIDE 35

35

Example

Filtered signal v.s. Original signal Time Signal

slide-36
SLIDE 36

36

Example

Filtered signal v.s. Original signal Time Signal IIR filters have nonlinear phase response => Distortion

slide-37
SLIDE 37

37

Persevering the shape of the signals not important in most of the applications …

slide-38
SLIDE 38

38

For example in audio applications, because human hearing system is not sensitive to distortion.

slide-39
SLIDE 39

39

Example

FIR

slide-40
SLIDE 40

40

Example

60 dB stopband attenuation

slide-41
SLIDE 41

41

Example

Order 1814 !

slide-42
SLIDE 42

42

Example

Order 588

slide-43
SLIDE 43

43

Example

Filtered signal using FIR Time Signal

slide-44
SLIDE 44

44

Example

Filtered signal v.s. Original signal Time Signal FIR filters have linear phase response !

slide-45
SLIDE 45

45

Persevering the shape of the signals is important in bio-signals applications

slide-46
SLIDE 46

Example %% Producing the oregingal signal % Sampling period Fs = 500; % Sampling interval Ts=1/Fs; % Length of the signal N=2000; % Maximum time Tmax=(N-1)*Ts; % Time vector t=0:Ts:Tmax;

slide-47
SLIDE 47

Example % Main frequencies & phase of the oreginal signal F1=10; F2=20; phi1=1.4; % Oreginal signal x=cos(2*pi*F1*t)+0.5*cos(2*pi*F2*t+phi1); % Plot range plot_range =(N/2-100:N/2+100); % Plot signal in the range figure(1) plot(t(plot_range),x(plot_range),'LineWidth',2.5); axis tight

slide-48
SLIDE 48

Example %% Generate noise in a specific frequency band (12-18 Hz) % Generate white Gaussian noise ns = randn(1,length(x))*3; % Design and load pass band filter: 12 to 18 Hz load PB_12_18; fvtool(PB_12_18) % Construct in-band noise ns_filtered=filter(PB_12_18,ns); % Signal + Noise x_ns=x+ns_filtered;

slide-49
SLIDE 49

Example % Plot oreginal signal and signal plus noise figure(3) plot(t(plot_range),x(plot_range),'LineWidth',2.5); hold on plot(t(plot_range),x_ns(plot_range),'LineWidth',2.5); axis tight

slide-50
SLIDE 50

Example %% single-sided frequency spectrum of the signal plus noise % Compute fft X=fft(x_ns); % Take abs and scale it X2=abs(X/N); % Pick the first half X1=X2(1:N/2+1); % Multiply by 2 (except the DC part), to compenseate % the removed side from the spectrum. X1(2:end-1) = 2*X1(2:end-1);

slide-51
SLIDE 51

Example % Frequency range F = Fs*(0:(N/2))/N; % Plot single-sided spectrum figure(4) plot(F,X1,'LineWidth',2.5) title('Single-Sided Amplitude Spectrum') xlabel('f (Hz)');

slide-52
SLIDE 52

Example %% Remove noise usin band-stop IIR filter % Design and load IIR band stop filter: 12 to 18 Hz load SB_12_18 fvtool(SB_12_18) % Filter the noise out x_clean_IIR=filter(SB_12_18,x_ns);

slide-53
SLIDE 53

Example % Single sided spectrum of cleaned signal % Compute fft X=fft(x_clean_IIR); % Take abs and scale it X2=abs(X/N); % Pick the first half X1=X2(1:N/2+1); % Multiply by 2 (except the DC part), to compenseate % the removed side from the spectrum. X1(2:end-1) = 2*X1(2:end-1);

slide-54
SLIDE 54

Example % Plot single-sided spectrum figure(6) plot(F,X1,'LineWidth',2.5) title('Single-Sided Amplitude Spectrum') xlabel('f (Hz)'); figure(7) plot(t(plot_range),x(plot_range),'LineWidth',2.5); hold on plot(t(plot_range),x_clean_IIR(plot_range),'LineWidth', 2.5); axis tight

slide-55
SLIDE 55

Example %% Remove noise usin band-stop FIR filter % Design and load FIR band stop filter: 12 to 18 Hz load SB_12_18_FIR fvtool(SB_12_18_FIR) % Filter the noise out x_clean_FIR=filter(SB_12_18_FIR,x_ns); % Single sided spectrum of cleaned signal % Compute fft X=fft(x_clean_FIR); % Take abs and scale it X2=abs(X/N); % Pick the first half X1=X2(1:N/2+1);

slide-56
SLIDE 56

Example % Multiply by 2 (except the DC part), to compenseate % the removed side from the spectrum. X1(2:end-1) = 2*X1(2:end-1); % Frequency range F = Fs*(0:(N/2))/N; % Plot single-sided spectrum figure(9) plot(F,X1,'LineWidth',2.5) title('Single-Sided Amplitude Spectrum') xlabel('f (Hz)');

slide-57
SLIDE 57

Example figure(10) plot(t(plot_range),x(plot_range),'LineWidth',2.5); hold on plot(t(plot_range),x_clean_FIR(plot_range),'LineWidth' ,2.5); axis tight

slide-58
SLIDE 58

Useful links

  • http://www.montefiore.ulg.ac.be/~ebrahimb

abaie/applieddigtial.htm