Analog and Digital Signals AD/DA conversion BME 1008 Introduction to Biomedical Engineering FIU,...
-
Upload
bailey-lodes -
Category
Documents
-
view
219 -
download
0
Transcript of Analog and Digital Signals AD/DA conversion BME 1008 Introduction to Biomedical Engineering FIU,...
Analog and Digital SignalsAD/DA conversion
BME 1008 Introduction to Biomedical EngineeringFIU, Spring 2015
Feb 5Lesson 3
http://commons.wikimedia.org/wiki/File:A-D-A_Flow.svg
Analog signal
Voltage changescontinuously withpressure.
Digital signal
Voltage has discrete values.
Analog signal
Analog signalsSmooth and continuous.
Most physical and biological signals, e.g. sound, temperature, blood pressure, pH.
Many sensors produce an analog signal; temperature, pressure, pH, light intensity etc.
Used typically by some older electronic devices, e.g. radio, TV, tape recorders, vinyl records.
time
Digital signalsDiscrete and discontinuous.
Used by digital computers, i.e. most modern computers, including PC and supercomupters.
Used by many modern electronic devices, e.g. satellite radio, digital TV, digital cameras, scientific instruments etc.
Advantages over analog signals: immune to noise, flexible hardware, easy computing, robust storing, transmission, compression.
0 1 0 1 0 1 0 1 0 1 0
time
amplitude
Analog-to-digital conversion(ADC)Modern telecommunication technology.Music recording, CD recordings. Hearing aids with digital signal processing.Scientific instruments, medical devices, e.g. ECG, EEG, pH-meters etc.
Digital imaging systems commonly use analog-to-digital converters in digitizing pixels.
Digital ECG
Analog or Digital?
• 100 billion (1011) neurons.• 100 trillion (1014) synapses.• peaks are the firing of the cells.• the analog looking signals at the bottom represent sub-threshold activity.
McCulloch and Pitts & The Binary Neuron
• Neurons first studied in the 40’s• Only two states were known, firing and not firing.
•Artificial neural networks can be trained to recognize complex input patterns, e.g. sounds, images, faces etc.
•Biological brain and its theoretical models work entirely different than the modern digital computers.
Modern Digital Computer
"Von Neumann Architecture" http://commons.wikimedia.org/wiki/File:Von_Neumann_Architecture.svg#mediaviewer/File:Von_Neumann_Architecture.svg
10110000 01100001.....
inc ecxjne .loop...
Machine Assembler C/C++ Matlab code
Abstraction from the details of the hardware
main() { printf("hello"); }
y = 1:10plot(y.^2)
low high
Analog-to-digital Converter ADC
Sampling rate of ADC
Quiz 3 - Sampling%Write the script in Matlab editor:clearsamplingInterval=1; %secondstime=0:samplingInterval:4; %secondssignalPeriod = 0.27; %secondssignal = sin(2*pi*time/signalPeriod);figure; plot(time,signal,'.-')
1) Adjust 'samplingInterval' to obtain proper plot of sin(). 2) What is the maximum 'samplingInterval'
for which the shape of sin() is preserved?
0 1 2 3 4-1
-0.5
0
0.5
1
undersampled
Quiz 3 Answer
samplingInterval= 0.1; 0.01; 0.001;% ok % good % oversampled
General rule: (sampling Interval) < (signal period)/2or (sampling frequency) > 2×(signal frequency),where (sampling frequency) = 1/(sampling Interval).
0 1 2 3 4-1
-0.5
0
0.5
1
0 1 2 3 4-1
-0.5
0
0.5
1
0 1 2 3 4-1
-0.5
0
0.5
1
Audio in Matlab[Y,FS,NBITS]=wavread('fileName.wav');% reads a WAVE audio file and returnsY -sampled data, FS - sample rate in Hertz, NBITS the number of bits per sample.
wavplay(Y,FS);% plays the signal in vector Y with sample frequency of FS Hertz% alternatively try audioplayer()>> help audioplayer
Matlab script to read and play a WAV file:
clearfileName = 'THE_MICROSOFT_SOUND.WAV';[Y,FS,NBITS] = wavread(fileName);plot(Y)wavplay(Y,FS)whosFSNBITS
0 2 4 6 8 10 12 14
x 104
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
3.852 3.854 3.856 3.858 3.86 3.862 3.864 3.866 3.868 3.87
x 104
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
THE_MICROSOFT_SOUND.WAV
FS = 22050 %Hz
NBITS = 8
length(Y)ans = 135005
%number of elements
Addition of sine signal to the original sound
time = (1:length(Y))/FS; % length(Y) - returns number of elements
sine = 0.2*sin(2*pi*FS/50*time)'; % ' - transpose to column vector
wavplay(sine,FS);pause(2)wavplay(Y+sine,FS);figure; plot(time,sine,'g-.',time,Y,'b--',... time,sine+Y,'r:')
% ... - line continuation
Quiz 4- Sounds clearFS = 5000; %sample frequency of 5kHztime = [0:25000]/FS; y1 = 0.25*sin(2*pi*FS/5*time);wavplay(y1,FS)pause(2)y2 = 0.25*sin(2*pi*FS/25*time);wavplay(y2,FS)pause(2)wavplay(y1+y2,FS)plot(time,y1,time,y2,time,y1+y2)
Quiz 5- WAV files Search Windows or Google for a '*.wav' file, and
copy the file to Matlab current folder. Import the file into Matlab with wavread() or
Menu/File/Import.Plot the samples. Play sound with wavplay() (or audioplayer() ).
Modify the sound to fade out.Hint: Multiply the audio samples by a decaying functionY2=Y.*exp(-(1:length(Y))/(length(Y)/5))';
Note:wavplay() and audioplayer() may be unavailable or not
working in some Matlab configurations, e.g. Matlab on Citrix, Mac OS.