Research Methods in Acoustics Lecture 8: Digital systems and filters

Slides:



Advertisements
Similar presentations
| Page Angelo Farina UNIPR | All Rights Reserved | Confidential Digital sound processing Convolution Digital Filters FFT.
Advertisements

Chapter 4 sampling of continous-time signals 4.5 changing the sampling rate using discrete-time processing 4.1 periodic sampling 4.2 discrete-time processing.
Symmetry and the DTFT If we know a few things about the symmetry properties of the DTFT, it can make life simpler. First, for a real-valued sequence x(n),
ECE 4371, Fall, 2014 Introduction to Telecommunication Engineering/Telecommunication Laboratory Zhu Han Department of Electrical and Computer Engineering.
Digital Coding of Analog Signal Prepared By: Amit Degada Teaching Assistant Electronics Engineering Department, Sardar Vallabhbhai National Institute of.
Chi-Cheng Lin, Winona State University CS412 Introduction to Computer Networking & Telecommunication Theoretical Basis of Data Communication.
Prof. Brian L. Evans Dept. of Electrical and Computer Engineering The University of Texas at Austin EE445S Real-Time Digital Signal Processing Lab Spring.
IT-101 Section 001 Lecture #8 Introduction to Information Technology.
Sampling, Reconstruction, and Elementary Digital Filters R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2002.
Chapter 4 Digital Transmission
Lecture 4: Sampling [2] XILIANG LUO 2014/10. Periodic Sampling  A continuous time signal is sampled periodically to obtain a discrete- time signal as:
First semester King Saud University College of Applied studies and Community Service 1301CT.
Basics of Signal Processing. frequency = 1/T  speed of sound × T, where T is a period sine wave period (frequency) amplitude phase.
Digital to Analogue Conversion Natural signals tend to be analogue Need to convert to digital.
Over-Sampling and Multi-Rate DSP Systems
Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.
EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
G52IIP, School of Computer Science, University of Nottingham 1 Image Transforms Fourier Transform Basic idea.
Numerical algorithms for power system protection Prof. dr. sc. Ante Marušić, doc. dr. sc. Juraj Havelka University of Zagreb Faculty of Electrical Engineering.
EE421, Fall 1998 Michigan Technological University Timothy J. Schulz 08-Sept, 98EE421, Lecture 11 Digital Signal Processing (DSP) Systems l Digital processing.
Lecture 1 Signals in the Time and Frequency Domains
Basics of Signal Processing. SIGNALSOURCE RECEIVER describe waves in terms of their significant features understand the way the waves originate effect.
CSC361/661 Digital Media Spring 2002
Wireless and Mobile Computing Transmission Fundamentals Lecture 2.
Lecture 7: Sampling Review of 2D Fourier Theory We view f(x,y) as a linear combination of complex exponentials that represent plane waves. F(u,v) describes.
Prof. Brian L. Evans Dept. of Electrical and Computer Engineering The University of Texas at Austin Lecture 4 EE 345S Real-Time.
Chapter 2 Signals and Spectra (All sections, except Section 8, are covered.)
Fundamentals of Digital Signal Processing. Fourier Transform of continuous time signals with t in sec and F in Hz (1/sec). Examples:
Vibrationdata 1 Unit 6a The Fourier Transform. Vibrationdata 2 Courtesy of Professor Alan M. Nathan, University of Illinois at Urbana-Champaign.
revision Transfer function. Frequency Response
GG313 Lecture 24 11/17/05 Power Spectrum, Phase Spectrum, and Aliasing.
Technological Educational Institute Of Crete Department Of Applied Informatics and Multimedia Neural Networks Laboratory Slide 1 FOURIER TRANSFORMATION.
Digital Signal Processing
Lecture 3: The Sampling Process and Aliasing 1. Introduction A digital or sampled-data control system operates on discrete- time rather than continuous-time.
Multimedia Sound. What is Sound? Sound, sound wave, acoustics Sound is a continuous wave that travels through a medium Sound wave: energy causes disturbance.
Lecture 2 Analog to digital conversion & Basic discrete signals.
2D Fourier Transform.
Chapter 2. Characteristics of Signal ※ Signal : transmission of information The quality of the information depends on proper selection of a measurement.
Fourier Analysis Patrice Koehl Department of Biological Sciences National University of Singapore
Prof. Brian L. Evans Dept. of Electrical and Computer Engineering The University of Texas at Austin EE445S Real-Time Digital Signal Processing Lab Spring.
Computer Communication & Networks
Sampling and Aliasing Prof. Brian L. Evans
EEE422 Signals and Systems Laboratory
Speech Signal Processing
Digital Signal Processing Lecture 4 DTFT
Topics discussed in this section:
Sampling and Aliasing Prof. Brian L. Evans
Digital Control Systems (DCS)
Unit 5 The Fourier Transform.
MECH 373 Instrumentation and Measurements
Chapter 8 Mohamed Bingabr
Chapter 3 Sampling.
4.1 Chapter 4 Digital Transmission Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Pulse Code Modulation (PCM)
Sampling and Quantization
Sampling rate conversion by a rational factor
EE Audio Signals and Systems
Chapter 2 Signal Sampling and Quantization
Image Acquisition.
Lecture 10 Digital to Analog (D-to-A) Conversion
MECH 373 Instrumentation and Measurements
Sampling and the Discrete Fourier Transform
Digital Control Systems Waseem Gulsher
Interpolation and Pulse Shaping
Chapter 2 Ideal Sampling and Nyquist Theorem
9.3 Analog-to-Digital Conversion
Analog to Digital Encoding
Lesson Week 8 Fourier Transform of Time Functions (DC Signal, Periodic Signals, and Pulsed Cosine)
Sampling and Aliasing.
Presentation transcript:

Research Methods in Acoustics Lecture 8: Digital systems and filters Jonas Braasch

Orthogonality Orthogonal (greek: orthos=straight/right, gonia=angle) is often used as synonym for perpendicular or right-angled. Two at 90° angle crossing streets are orthogonal to each other The dot-product of two vectors is zero if both vectors are orthogonal to each other.

Orthogonality Vector in 2- or 3-dimensional Euclidean space

Orthogonality Vector in 2- or 3-dimensional Euclidean space Orthogonal case:

Orthogonality Vector in 2- or 3-dimensional Euclidean space angle: Length of vector angle=1 parallel angle=0 orthogonal angle=-1 anti-parallel A unit vector has the length of one.

Orthogonality angle between two vectors angle between n·m

Orthogonality Vector in 2- or 3-dimensional Euclidean space a) a) b) 90° 90° b) c) c) d) 90° d) 45°

Digital Signals (Sampling) samples The function y(t) is a continuous (analog) signal that we would like to transform into a digital signal. We can do this by measuring the value of the continuous signal at constant time intervals n·T (with n=0,1,2,3,…): Fs=48 kHz f=1000 Hz

Sampling Rate The sampling frequency (sampling rate fs or Fs) is defined as the number of samples that are recorded during a given time interval. The unit is typically [fs]=1/s or Hz. The sampling frequency is the inverse of the sampling interval T after which we recorded the next sample. Fs=48 kHz, f=1000 Hz, T=0.1 ms T time [s]

Example: Fs=48 kHz, f=1000 Hz time [s] samples

Fs=48 kHz, signal 30 kHz Fs=48 kHz, signal 20 kHz

Quantization In a digital signal, each sample is quantized to a new integer value. In computer systems, we transmit information using and on/off code instead of having decimal digits from 0−9 (Base 10). Internally, the computer only knows two digits 0 and 1 (Base 2). It operates on a binary code. One digit, which can be either 0 or 1 is called a bit. A group of 8 bits is referred to as one byte. We can easily transform a binary number into a number to the base 10: With x10 the number to the base 10 and x2,n the nth digit of the base-2 number. Example: x2=1011

Quantization The sampling frequency (sampling rate fs or Fs) is defined as the number of samples that are recorded during a given time interval. The unit is typically [Fs]=1/s or Hz. The sampling frequency is the inverse of the sampling interval T after which we recorded the next sample. 20*log10(256/2) =20*log10(2^8/2) =42.1442 20*log10(4096/2) =20*log10(2^12/2) =66.2266 20*log10(65536/2) =20*log10(2^16/2) =90.3090 20*log10(16777216/2) =20*log10(2^24/2) =138.4738 Divide by 2, because one bit is lost for the sign (plus or minus)

Conversion: Binary to Decimal function [y]=convbin(x) numofdigits=floor(log2(x)); for n=numofdigits+1:-1:1 y(n)=mod(x,2); x=floor(x./2); end % of for

Binary Demo Demo Results: zdB =−10.6060 dB ydB = 31.4045 dB x=randn(1000,1); x=abs(x); x=(128.*x./max(abs(x))); x0=round(x); for n=1:length(x0) y2=convbin(x0(n)); y(n)=convBase10(y2); end % of for z=y-x'; % level of signal yr=sqrt(mean(y.^2)); ydb=20*log10(yr) % quantization error dB zr=sqrt(mean(z.^2)); zdb=20*log10(zr) Demo Results: zdB =−10.6060 dB ydB = 31.4045 dB ydB−zdB = 42.0105 dB Compare to the theoretical result of 20*log10(2^8/2)=42.1442 dB

Theorems Nyquist–Shannon sampling theorem describes the conditions in which the continous signal can be perfectly reconstructed. If the conditions of the Nyquist–Shannon sampling theorem are met, the sampled signal can be reconstructed using the Whittaker–Shannon interpolation formula. Typically, the signal is bandwidth limited to fs/2 (Nyquist-Frequency). However, it is also possible to unambiguously code signals above this frequency, if the continuous signal is limited to a corresponding low-frequency cut-off frequency. This is often useful in radio broadcast.

Aliasing http://en.wikipedia.org/wiki/Aliasing The effect that two different continuous signals to become indistinguishable when sampled is called aliasing. Aliasing typically occurs when a signals frequency is more the than twice the sampling frequency (see red curve). It then becomes an alias of a lower frequency (blue curve). An anti-aliasing filter, which is a low-pass filter is used to avoid this phenomenon. All frequencies above fs/2 are eliminated before they are converted into a digital signal.

Fourier Transformation with e-function Basically, we can also treat non-harmonic functions by setting T to ∞. We can also use the complex e-function instead of sine and cosine: x=2pt, T→∞

Fourier Transformation of a sine signal Fs=12000; t=0:1./Fs:1; % create time signals ffttabs=8182; f=(1./ffttabs:1./ffttabs:1).*Fs; x=sin(2*pi*1000*t); y=fft(x,ffttabs); plot(f,imag(y),'r:','LineWidth',2) hold on plot(f,real(y),'LineWidth',2) hold off ylabel('amplitude','FontSize',14); xlabel('frequency [Hz]','FontSize',14); set(gca, 'FontSize',14);

Samples vs. time and frequency Fs=12000; t=0:1./Fs:1; % create time signals % choose 1./Fs as step size (equals one sample) % A similar approach for the frequency space ffttabs=8182; % number of frequency samples f=(1./ffttabs:1./ffttabs:1).*Fs; % We know that the whole frequency space ranges % from 0 to Fs

Fourier Transformation of sine signals Imaginery component real component Real part, axis-symmetrical Imaginery part, point-symmetrical

Fourier Transformation of a cosine signal Fs=12000; t=0:1./Fs:1; % create time signals ffttabs=8182; f=(1./ffttabs:1./ffttabs:1).*Fs; x=sin(2*pi*1000*t); x2=cos(2*pi*1000*t); y2=fft(x2,ffttabs); plot(f,real(y2),'LineWidth',2) hold on plot(f,imag(y2),'r:','LineWidth',2) hold off ylabel('amplitude','FontSize',14); xlabel('frequency [Hz]','FontSize',14); set(gca, 'FontSize',14);

Fourier Transformation of a cosine signal real component Imaginery component Note, that now the real component has the larger peak

Power spectrum The amplitude of the Fourier signal can be estimated from the magnitude of the Fourier transformed signal H(w): We can also determine the power signal We used the following relationship

Power spectrum figure % Power spectrum % sine signal Pyy=y.*conj(y); subplot(2,1,1); plot(f,Pyy,'LineWidth',2) ylabel('Power spectrum','FontSize',14); xlabel('frequency [Hz]','FontSize',14); set(gca, 'FontSize',14); % cosine signal Pyy2=y2.*conj(y2); subplot(2,1,2); plot(f,Pyy2,'r','LineWidth',2);

Power spectrum sine signal cosine signal

Phase The phase of the signal is the argument of the spectrum:

Phase p1 = atan2(imag(y), real(y)); p2 = atan2(imag(y2), real(y2)); phase1=180/pi*unwrap(p1); phase2=180/pi*unwrap(p2); figure plot(f,phase1,'LineWidth',2); hold on plot(f,phase2,'r:','LineWidth',2); plot(f,phase2-phase1,'g','LineWidth',2); hold off ylabel('phase [deg]','FontSize',14); xlabel('frequency [Hz]','FontSize',14); set(gca, 'FontSize',14);

Phase Blue=sine red=cosine Green=phase difference Phase difference 90°@ 1000 Hz

Fourier transformation of an impulse x=zeros(length(t),1); x(1)=1; figure stem(x) ylabel('amplitude','FontSize',14); xlabel('time [samples]','FontSize',14); axis([0 12 0 1.2]); set(gca, 'FontSize',14);

Impulse

Fourier transformation of an impulse x=zeros(length(t),1); x(1)=1; x2=zeros(length(t),1); x2(8)=1; figure stem(x) ylabel('amplitude','FontSize',14); xlabel('time [samples]','FontSize',14); axis([0 12 0 1.2]); set(gca, 'FontSize',14); stem(x2)

Impulse

Fourier Transformation f=(1./ffttabs:1./ffttabs:1).*Fs; y=fft(x,ffttabs); y2=fft(x2,ffttabs); figure % Power spectrum Pyy=y.*conj(y); Pyy2=y2.*conj(y2); plot(f,Pyy,'LineWidth',2) hold on plot(f,Pyy,'r--','LineWidth',2) hold off ylabel('Energy','FontSize',14); xlabel('frequency [Hz]','FontSize',14); axis([0 12000 0 1.2]); set(gca, 'FontSize',14);

Magnitude Spectrum

Phase calculation p1 = atan2(imag(y), real(y)); phase1=180/pi*unwrap(p1); p2 = atan2(imag(y2), real(y2)); phase2=180/pi*unwrap(p2); figure plot(f,phase1,'LineWidth',2) hold on plot(f,phase2,'r--','LineWidth',2) hold off ylabel('phase [deg]','FontSize',14); xlabel('frequency [Hz]','FontSize',14); axis([0 12000 -2600 100]) set(gca, 'FontSize',14);

Phase

Phase and Group delay phase delay group delay

Group delay figure domega=pi*Fs/length(y); R=real(y); I=imag(y); dI=derive(I,domega); dR=derive(R,domega); grpdelay=-(R.*dI-I.*dR)./(abs(y).^2); plot(f,grpdelay*Fs./2,'LineWidth',2)

Group delay (cont.) domega=pi*Fs/length(y2); R=real(y2); I=imag(y2); dI=derive(I,domega); dR=derive(R,domega); grpdelay2=-(R.*dI-I.*dR)./(abs(y2).^2); hold on plot(f,grpdelay2*Fs./2,'r','LineWidth',2) hold off ylabel('group delay [in samples]','FontSize',14); xlabel('frequency [Hz]','FontSize',14); axis([0 12000 -1 8]) set(gca, 'FontSize',14);

Group delay

Phase and Group delay 108° 72° Dy 36° 0° Dx 100 200 300 f [Hz] Phase delay describes the overall delay of the phase Group delay describes the time delay compare to adjacent frequencies 108° tgr=dy/dx 72° Dy 36° tph=Dy/Dx 0° Dx 100 200 300 f [Hz] phase delay group delay

What does linear phase mean? T=1/f [ms] f=360° · t/T 108° 300 Hz 200 Hz 72° 100 Hz 36° 1ms

Linear phase 108° 72° 36° 0° 100 200 300 f [Hz] Let us draw the values from the last slide: constant delay<->linear phase 108° 72° 36° 0° 100 200 300 f [Hz]

Impulse Fs=12000; ffttabs=8182; x=FIR1(512,0.5,'low'); plot(x,'LineWidth',2); ylabel('amplitude','FontSize',14); xlabel('time [samples]','FontSize',14); set(gca, 'FontSize',14);

FIR low-pass filter (300 Hz), n=512

Magnitude spectrum f=(0:1./(ffttabs-1):1).*Fs; y=fft(x,ffttabs); figure % Power spectrum Pyy=y.*conj(y); plot(f,Pyy,'LineWidth',2) ylabel('Energy','FontSize',14); xlabel('frequency [Hz]','FontSize',14); axis([0 12000 0 1.2]); set(gca, 'FontSize',14);

Magnitude spectrum

Phase p1 = atan2(imag(y), real(y)); phase1=180/pi*unwrap(p1); figure plot(f,phase1,'LineWidth',2) ylabel('phase [deg]','FontSize',14); xlabel('frequency [Hz]','FontSize',14); set(gca, 'FontSize',14);

Phase

Group delay figure domega=pi*Fs/length(y); R=real(y); I=imag(y); dI=derive(I,domega); dR=derive(R,domega); grpdelay=-(R.*dI-I.*dR)./(abs(y).^2); phasedelay=-unwrap(p1)./(2.*pi.*f); plot(f,grpdelay*Fs./2,'LineWidth',2) hold on plot(f,1+phasedelay*Fs,'r','LineWidth',2) hold off ylabel('delay [in samples]','FontSize',14); xlabel('frequency [Hz]','FontSize',14); legend('group delay','phase delay'); %axis([0 12000 -1 8]) %figure %grpdelay(1,1) set(gca, 'FontSize',14);

Phase and Group Delay

FIR low-pass filter (300 Hz), n=32

Magnitude spectrum

Phase

Group and phase delay

Linear plot

Log-frequency plot

Log-log plot cut-off frequency −3dB threshold

Homework 6, #1 % Pythagorean Tempering function [freqPytha,freqEqual,devCent]=Interval2Freq(interval) % Pythagorean Tempering rFreq = 440; %Hz (A4) reference Frequency fifth = 3/2; % Determine intervals for first octave for n=2:12 rFreq(n)=rFreq(n-1)*3/2; if rFreq(n)>rFreq(1)*2 rFreq(n)=rFreq(n)/2; end % of if end % of for rFreq=sort(rFreq); octave=floor(interval./12); chroma=mod(interval,12); freqPytha=2.^octave.*rFreq(chroma+1); % Equal Tempering freqEqual=rFreq(1).*2.^(interval./12); devCent=1200.*log2(freqPytha./freqEqual);

Results >> [freqPytha,freqEqual,devCent]=Interval2Freq([1:12]) 469.8633 495.0000 528.5962 556.8750 594.6707 626.4844 660.0000 704.7949 742.5000 792.8943 835.3125 880.0000 freqEqual = 466.1638 493.8833 523.2511 554.3653 587.3295 622.2540 659.2551 698.4565 739.9888 783.9909 830.6094 880.0000 devCent = 13.6850 3.9100 17.5950 7.8200 21.5050 11.7300 1.9550 15.6400 5.8650 19.5500 9.7750 0

Homework 6, #2 function [y,t]=OrganPipe(pipelength,reflectioncoef,signal) c=343; % m/s Fs=48000; x=signal; t=(0:length(signal)-1)./Fs; PipeTabs=round(Fs*pipelength/c); l=PipeTabs/Fs*c; ForwardDelayLine=zeros(PipeTabs+1,1); BackwardDelayLine=zeros(PipeTabs+1,1); PipeTabs=PipeTabs+1; for n=1:(length(x)) ForwardDelayLine(2:PipeTabs)=ForwardDelayLine(1:PipeTabs-1); ForwardDelayLine(1)=-1*BackwardDelayLine(1)+x(n); y(n)=ForwardDelayLine(1); BackwardDelayLine(1:PipeTabs-1)=BackwardDelayLine(2:PipeTabs); BackwardDelayLine(PipeTabs)=reflectioncoef*y(n); end % of for

Result open pipe [y]=OrganPipe(0.5,-0.7,[1; zeros(4800,1)]);

Result open pipe [y,t]=OrganPipe(0.5,-0.7,[1; zeros(4800,1)]);

Result closed pipe [y,t]=OrganPipe(0.5,0.7,[1; zeros(4800,1)]);

convolution x=randn(4800,1); [y,t]=OrganPipe(0.5,0.7,[1; zeros(4800,1)]); Z=conv(x,y);