1 views

Uploaded by S M Shamim শামীম

matlab

- DSP Assignment 1_2017
- Introduction to USRP.pdf
- 30221_14
- 350man-a7.pdf
- Parasitic Coupling in RF Circuits- A Real-Life Experience
- GNURAdioDoc-3
- DIGI260_ADC2
- USRP Documentation
- A 040302
- Overcome High-Speed Analog Measurement Challenges
- Understanding Data Acquisition - Data That Matters
- Solid State Meter1
- Audio Texas
- RT101 Digital Imaging(2)
- About ADC Conversion
- JSIP_2014051615300944.pdf
- Scientech 2403 AM
- Low Cost AD Converter.pdf
- Blue-Eyes-Technology-IEEE+FORMAT
- MAGLEV User Manual

You are on page 1of 12

Louis Goldstein

I. Digital representation of audio signals

corresponding to a voltage (or ultimately air pressure or velocity). These samples can be

converted into a continuous voltage by using a device called a digital-to-analog

converter (DAC). The voltages can then be converted to air pressure fluctuations by

means of a loudspeaker, headphones, etc. Conversely, a continuous audio signal can be

digitized using a device called an analog-to-digital converter (ADC). The digitized

values can then be stored in the computers memory, on a storage device. It can then be

played back through the use of a DAC. Analog-to-digital conversion and digital-to-

analog conversion happen behind the scenes when you use a microphone to input

sound to a computer, or play a sound out.

In a digitized signal, the time interval between each successive sample is referred to as

the sampling period (T) of the system. The number of samples acquired (or output) in a

second (i.e., 1/T) is referred to as the sampling rate (srate). Number of samples per

second is usually referred to as Hertz (Hz). Common sampling rates for speech are

10000 Hz (sometimes written 10 KHz), 20000 Hz, and 22050 Hz. The standard sampling

rate for music (CD) is 44100 Hz (the reason for this will be discussed later).

MATLAB is a system that allows us to specify digital signals in a simple way, operate

on them mathematically, plot them as time waveforms, calculate their spectra, and play

them out over headphones or speakers. The system can be used interactively (you can

just sit and type and the results of each operation will be displayed in sequence), or

you can write scripts that are sequences of MATLAB statements, and constitute

programs written in this language.

The basic unit of MATLAB is the matrix. A matrix is a set of numbers arranged into

rows and columns. A matrix with a single row (or a single column) is called a vector.

The power (and simplicity) of MATLAB stems from its treatment of matrices (and

vectors) as primitives. A single number (scalar) is the limiting case of a matrix with a

single row and a single column. In what we will be doing, we will make extensive use

of vectors. A digital signal can be represented as a vector, (usually with a large number

of elements) with the individual columns (or rows, depending on the orientation) of the

vector corresponding to the successive signal samples.

III. Some basic MATLAB examples

In what follows lines beginning with were typed by me. Other lines were typed back

by MATLAB.

(1) To define a vector as a sequence of values, set it equal to the desired of sequence of

values, enclosed in square brackets. For example, to define a vector X,

X = [9 8 2 4 8 1 2 8 7]

X =

9 8 2 4 8 1 2 8 7

(2) To plot the points of a vector in sequence across the page, use the plot command,

with the name of the vector as an argument (in parentheses). If the only argument is

the name of a single vector, the horizontal axis of the plot shows the number of each

successive vector element, while the vertical axis shows the value of each element.

plot (X)

1

1 2 3 4 5 6 7 8 9

(3) One a vector has been defined, it can be operated on by mathematical operators. For

example, to take the vector X and add 5 to every element in it:

X = X + 5

X =

14 13 7 9 13 6 7 13 12

plot (X)

14

13

12

11

10

6

1 2 3 4 5 6 7 8 9

X = X * .5

X =

Columns 1 through 7

3.5000

Columns 8 through 9

6.5000 6.0000

plot (X)

6.5

5.5

4.5

3.5

3

1 2 3 4 5 6 7 8 9

(4) A vector can also be filled with a progression of values from a starting value to an

ending value. To do so, set the vector name equal to the beginning_value : ending

value.

Z = 1:9

Z =

1 2 3 4 5 6 7 8 9

plot (Z)

9

1

1 2 3 4 5 6 7 8 9

(5) By default, the increment between beginning value an d ending value is 1.

However, this can set to whatever you want by setting the vector equal to

beginning_value : increment: ending_value.

Z = 0:.1:.8

Z =

Columns 1 through 7

0.6000

Columns 8 through 9

0.7000 0.8000

plot (Z)

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

1 2 3 4 5 6 7 8 9

(6) In the plots we have done so far, the successive points of the vector have been

connected by a line. Sometimes it is useful to see just the successive points themselves,

and not connect them with a line. To do this add an additional argument to the plot

command, which show symbol (in quotes) that you want to see represent each point

(choices are o, +, *, ., x)

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

1 2 3 4 5 6 7 8 9

(7) Another plot option is the give two vectors as arguments to the plot command.

In this case, the x-axis values come from the first vector, while y-axis value come from

the second. The two vectors must each have the same number of elements.

plot(Z,X,'o')

6.5

5.5

4.5

3.5

3

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

IV. Using MATLAB to generate the digital representation of a pure tone.

(N.B. if you end a MATLAB line with a semicolon, then it will NOT respond by listing

out all of the values of the vector that you are specifying. This is useful when we deal

with fairly long vectors).

srate = 10000;

(2) Fill a vector with the time values of the successive samples of a digital signal

beginning at time 0, and going up to a tenth of a second. The increment will be the

sampling period, or the reciprocal of the sampling rate.

t = 0:1/srate:.1;

plot (t,'o')

0.1

0.08

0.06

0.04

0.02

0

0 200 400 600 800 1000 1200

particular desired tone frequency. In this case, we choose to generate a 200 Hz tone.

The corresponding angular velocity is then 2 times 200. pi is a built-in MATLAB

variable whose value is an approximation to .

omega = 2*pi*200

omega =

1.2566e+03

(4) For each of the sample times (vector t), calculate the elapsed angle that would be

traversed (theta) by that time (angular velocity times elapsed time).

theta = omega*t;

plot (theta)

140

120

100

80

60

40

20

0

0 200 400 600 800 1000 1200

plot (t,theta)

140

120

100

80

60

40

20

0

0 0.02 0.04 0.06 0.08 0.1

(5) To get the value of a pure tone signal (simple harmonic motion) at each sample

point, take the sine of the elapsed angle:

plot (wave)

&

!'%

!'$

!'#

!'"

!!'"

!!'#

!!'$

!!'%

!&

! "!! #!! $!! %!! &!!! &"!!

soundsc (wave,srate)

Playing a mono buffer of length 1001 and sample rate 10000.

plot (t,wave)

!"*

!"(

!"&

!"$

!!"$

!!"&

!!"(

!!"*

!#

! !"!# !"!$ !"!% !"!& !"!' !"!( !"!) !"!* !"!+ !"#

V. Complex Numbers

and j are both special character that represent the square root of -1. Here are some

simple examples.

(1) Define the argument (theta) and magnitude (magnitude) of a complex number.

theta = pi/6

theta =

0.5236

magnitude = 3

magnitude =

(2) Define a complex number (z1) using theta and magnitude. MATLAB returns its

value in rectangular form.

z1 = magnitude*exp(i*theta)

z1 =

2.5981 + 1.5000i

(3) The functions real and imag get the real and imaginary parts of a complex

number.

real(z1)

ans =

2.5981

imag(z1)

ans =

1.5000

(4) We can also get the real (x1) and imaginary (y1) parts trigonometri cally.

x1 = magnitude*cos(theta)

x1 =

2.5981

y1 = magnitude*sin(theta)

y1 =

1.5000

(5) Now define a complex number (z2) by specifying it real and imaginary parts.

x2 = 5

x2 =

y2 = 5

y2 =

z2 = x2+i*y2

z2 =

5.0000 + 5.0000i

(6) MATLAB functions abs and angle get the magnitude and argument (angle) of

z2.

abs (z2)

ans =

7.0711

angle (z2)

ans =

0.7854

sqrt(x2^2 + y2^2)

ans =

7.0711

atan (y2/x2)

ans =

0.7854

- DSP Assignment 1_2017Uploaded byAbhishek Pandey
- Introduction to USRP.pdfUploaded byBashir
- 30221_14Uploaded bySusana Rojas
- 350man-a7.pdfUploaded bygusfaj
- Parasitic Coupling in RF Circuits- A Real-Life ExperienceUploaded byapi-19668941
- GNURAdioDoc-3Uploaded byNahum Setu
- DIGI260_ADC2Uploaded by1553
- USRP DocumentationUploaded byish2028
- A 040302Uploaded byBILLA420
- Overcome High-Speed Analog Measurement ChallengesUploaded byFernando Vidoni
- Understanding Data Acquisition - Data That MattersUploaded bySatya Sai Babu Yeleti
- Solid State Meter1Uploaded byyogi_swarn
- Audio TexasUploaded byAntonio Pitta
- RT101 Digital Imaging(2)Uploaded byNadeem Hameed
- About ADC ConversionUploaded byCorneliu Ax
- JSIP_2014051615300944.pdfUploaded byNgocan Huynh
- Scientech 2403 AMUploaded bySantosh Kumar
- Low Cost AD Converter.pdfUploaded bymike_helpline
- Blue-Eyes-Technology-IEEE+FORMATUploaded byBalaji King
- MAGLEV User ManualUploaded byAnthony Littlehouses
- Nonuniform Sampling of Periodic Bandlimited SignalsUploaded byAbderrahmane Elboubakri
- Communication Solved ProblemsUploaded byAngel Linton
- DASP-52282 User Manual E2Uploaded bytricky777
- Digital Efect PedalUploaded byGalingasis Juozelis
- Programming ESP8266- ESP-201 Stand Alone With Arduino IDE_ 6 StepsUploaded byZenón Martínez Cruz
- IR sensor based Distance measurement system:Uploaded byRajkeen Chamanshaikh
- Signal LabUploaded byjaxbaiad
- elec111 w4Uploaded bykanye
- dsp manualUploaded byJason Wiggins
- E560_AE23_DBUploaded byHoang Nguyen

- BTech_IT_curriculum.pdfUploaded byS M Shamim শামীম
- Let Us C solutions.pdfUploaded bywarbaas
- CS_2019Uploaded byS M Shamim শামীম
- ct-1.docxUploaded byS M Shamim শামীম
- Bf082db15fee55ebd84e103730d847bf OriginalUploaded byS M Shamim শামীম
- Bf082db15fee55ebd84e103730d847bf OriginalUploaded byS M Shamim শামীম
- Bf082db15fee55ebd84e103730d847bf OriginalUploaded byS M Shamim শামীম
- 08.SolutionsUploaded byS M Shamim শামীম
- SQL QueriesUploaded bysvelama
- Assignment 1 CFD 1a cUploaded byS M Shamim শামীম
- Assignment 1 CFD 1a cUploaded byS M Shamim শামীম
- 180948108 Let Us C Solutions PDFUploaded byS M Shamim শামীম
- j3Uploaded byS M Shamim শামীম
- Assignment_1_CFD_1a_c.pdfUploaded byS M Shamim শামীম
- 28GHz_55-100_m.xlsxUploaded byS M Shamim শামীম
- WorkUploaded byS M Shamim শামীম
- mod1l1Uploaded byS M Shamim শামীম
- Lab1 HandoutUploaded byS M Shamim শামীম
- notice-2-1Uploaded byS M Shamim শামীম
- ch5-pcuUploaded byS M Shamim শামীম
- Admission NoticeUploaded byS M Shamim শামীম
- Pese NationUploaded byS M Shamim শামীম
- CSE-12-01-19Uploaded byS M Shamim শামীম
- Teacher Application Form Bangla (10 Jun 2018)Uploaded byS M Shamim শামীম
- DB Course ObjectiveUploaded byS M Shamim শামীম
- ch5-pcuUploaded byayush gupta
- Lab8Week9Uploaded byS M Shamim শামীম
- mod1l1Uploaded bysamqolive
- Literature ReviewUploaded byS M Shamim শামীম
- ICT-12-01-19Uploaded byS M Shamim শামীম

- 1 Power Upgrading of Transmission Line by Combining ACDC TransmissionUploaded byapi-19508046
- Broadcasting Digital Media Industry in India - Full Report.pdfUploaded bySiddhant Gupta
- Rotel RVC220 CB radio user instruction manualUploaded byRichard Shireby
- (Chapter 11) Digital T-carriers and Multiplexing (71-77)Uploaded byWelvin Asid
- Design and Test Technologies of a RepeaterUploaded bynarges5058
- Part 2 Tlm2.0 OverviewUploaded byoooooops_m
- Monitoring and Control of Grain Storage Using PlcUploaded byInternational Journal of Research in Engineering and Technology
- USB Oscilloscope ManualUploaded byvineetkrsingh
- Dell-u2312h User's Guide en-usUploaded byJoeSmith
- simeas pUploaded byRaminder Bhoee
- Circuit Cellar[Nonlinear.ir] 023 1991Uploaded byjlcastroa
- FinalProjectReport_SondurUploaded byDon_Turbo
- Computer Systems: Digital Design, Fundamentals of Computer Architecture and Assembly LanguageUploaded bycedriccheah
- ag4 gUploaded bylobesak
- DSS2 User Guide 11-8-11Uploaded byjrfj
- Radio Frequency Spectrum in NepalUploaded byrosan.sapkota
- 8051 notesUploaded bySringaSyam
- Bridge rectifierUploaded byapi-3753995
- IBC97.pdfUploaded byDoan Van
- 2VAA002081 en S Control SPSOE Distributed Sequence of EventsUploaded byanbarasan
- Cock Croft WaltonUploaded byLaellyArifanny
- DB9 to DB25Uploaded byBayu Wiro
- Semiconductor Devices for Optical Communication - KresselUploaded bySurito_GT
- DigitalUploaded byPham Long
- Electronics by GibiliscoUploaded bySally Siman
- Jyotish Yog DipikaUploaded byKALSHUBH
- Igbt DriveUploaded byNAYEEM
- MNL-0630Uploaded byKumaresan Dhandapani
- 06_GGS-000396-07E_SPECUploaded byeduardo-mw
- SM2246XT Datasheet_v07_20150827[0]Uploaded byAnonymous 16WzJT2zgt