1 views

Uploaded by S M Shamim শামীম

matlab

matlab

© All Rights Reserved

- Sampling noise (personal notes)
- Continuous-Time Delta-Sigma Modulators for High-Speed AD Conversion
- Lab Sheet 312
- Arm Report
- Multimeter Kit v1
- Elango Resume
- Choose the Right FFT Window Function When Evaluating Precision ADCs _ Analog Content From Electronic Design
- New Mold Xk3100-B3 Manual E-111
- Folding ADCs ADI
- Mechatronics Test Questions Set - 2
- Analog Building Blocks
- Resume Elango
- Resume Elango
- S12ATD10B8CV2
- CellTopBMS User Manual Rev1.1
- Pcm
- Adc
- Lica Questions
- ADC0804.pdf
- daq_ho

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

- Sampling noise (personal notes)Uploaded byMatt
- Continuous-Time Delta-Sigma Modulators for High-Speed AD ConversionUploaded byEnrique Tejada Gamero
- Lab Sheet 312Uploaded byপিয়ালহাসান
- Arm ReportUploaded byRamnarayan Shreyas
- Multimeter Kit v1Uploaded byKit Vi Điều Khiển
- Elango ResumeUploaded byapi-3717961
- Choose the Right FFT Window Function When Evaluating Precision ADCs _ Analog Content From Electronic DesignUploaded byelbpatricio
- New Mold Xk3100-B3 Manual E-111Uploaded byAlvaro Pulido Hernandez
- Folding ADCs ADIUploaded byNishit Shah
- Mechatronics Test Questions Set - 2Uploaded byShyam Chandra
- Analog Building BlocksUploaded byAmit Mehta
- Resume ElangoUploaded byapi-3717961
- Resume ElangoUploaded byapi-3717961
- S12ATD10B8CV2Uploaded byMartinez Juan Carlos
- CellTopBMS User Manual Rev1.1Uploaded bytuanhai1989
- PcmUploaded byMaryam Shah
- AdcUploaded byIsra Malik
- Lica QuestionsUploaded byJ Ravi
- ADC0804.pdfUploaded byCarbon Nano Tube
- daq_hoUploaded byshrinivasrm
- 16 Beljic Vujicic Zupunski Mitrovic VujicicUploaded byJohn Bihag
- FE_Sem_2_0910.pdfUploaded byshah
- Medición Parámetros PD Enero 2006Uploaded byfreddyrivera
- SamplingUploaded byarsh
- MapleSim dSPace Getting Started GuideUploaded byGregory Alberto Rodríguez Palomino
- Definitions DcomUploaded byRabia Abu Bakar
- VintageBlueConsolePro ManualUploaded bywoofpax
- Manual Da National Semiconductors Que Ensina Sobre Condicionamento de SensoresUploaded byPhotogenesis Biotecnologia Phbio
- 0zok71qtc00o8590w11jpr7j7zwyUploaded byTecnicoItca
- Adc 0804Uploaded byAndySilvand

- Assignment_1_CFD_1a_c.pdfUploaded byS M Shamim শামীম
- VUploaded byS M Shamim শামীম
- 6E975d01Uploaded byYassine Ramli
- EC-362 MP&MC LABUploaded bySreelatha Shrinidhi Goudageri
- 8086Overview NEWUploaded byBhaswar Majumder
- 10 Vol 4 No 6Uploaded byArivukarasi Rajasekaran
- file03c336b743d8489d9d2f63914d902d09Uploaded byS M Shamim শামীম
- 1B1499INTROUploaded byS M Shamim শামীম
- Ads Micros TipUploaded byHanane Nasr
- Microstrip Patch Antenna DesignUploaded byNgoc Lan Nguyen
- Java Previous Year Question PapersUploaded byS M Shamim শামীম
- 2017Uploaded byS M Shamim শামীম
- j3Uploaded byS M Shamim শামীম
- Assignment 1 CFD 1a cUploaded byS M Shamim শামীম
- ct-1.docxUploaded byS M Shamim শামীম
- 28GHz_55-100_m.xlsxUploaded byS M Shamim শামীম
- 08.SolutionsUploaded byS M Shamim শামীম
- 180948108 Let Us C Solutions PDFUploaded byS M Shamim শামীম
- Let Us C solutions.pdfUploaded bywarbaas
- CS_2019Uploaded byS M Shamim শামীম
- Bf082db15fee55ebd84e103730d847bf OriginalUploaded byS M Shamim শামীম
- SQL QueriesUploaded bysvelama
- Bf082db15fee55ebd84e103730d847bf OriginalUploaded byS M Shamim শামীম
- BTech_IT_curriculum.pdfUploaded byS M Shamim শামীম
- Literature ReviewUploaded byS M Shamim শামীম
- notice-2-1Uploaded byS M Shamim শামীম
- Pese NationUploaded byS M Shamim শামীম

- SAP Sapscripts Tips and TricksUploaded byHouari Hou
- E-commerce Challenges, Solutions and Effectiveness Perspective BangladeshUploaded bynaimenim
- Marketing Plan (Word)Uploaded bykhairul izzudin
- 172-VPNUploaded bybanstyle123456789
- Coherent Optical – OFDM using 64QAM to high data rates 1.60 Tb/s over 4500 kmUploaded byIJSRP ORG
- Sanjib Kumar Saren - Review of Flexible Manufacturing System Based on Modeling and Simulation_v21_2Uploaded byAmrik Singh
- 10 4 14 New Long Srp PriceUploaded byJon Snow-Stark
- Mer Letti 2010Uploaded bysylviasf
- Leica TS02plusUploaded bybbutros_317684077
- Linux AccronymsUploaded byMurthy Ketha
- Final_iSupplier_Reference_Guide_v1_0Uploaded bySupratik Dey
- IRJET-A review paper on closed loop control of bldc motor using fuzzy logicUploaded byIRJET Journal
- Tcp IPUploaded byHarsh Boxer
- GROUP2 - Activity No1Uploaded byJoel M. Alfuerto
- Shortcut Keys for Microsoft 2007Uploaded bySudhanshu Gupta
- bim-after-dark-design-bim-ebook.pdfUploaded byAngelGC
- 1438 Learning Path Distributions Using Nonequilibrium Diffusion NetworksUploaded byNina Brown
- MusicMaster V5_SR6_ReleaseNotesUploaded byONAIR.DE
- CDVI Centaur51 Poster Eng WebUploaded byDon Gowewey
- KenwoodUploaded bycedro40
- Gshdsl Efm Atm HwicsUploaded byBadr Aziz
- TW Análisis de Tendencias #1 Software Defined NetworkingUploaded byChristian Baidal
- Swift MailerUploaded bydan3dss
- 9781783283613_Getting_Started_with_Clickteam _Fusion_Sample_ChapterUploaded byPackt Publishing
- Ipocc Dialer EnUploaded byMarthaGutnara
- The Tsunami WaveUploaded byBenjamin Chua
- Pragmatic Project Automation How to Build, Deploy, And Monitor Java ApplicationsUploaded byArthur Kharyukov
- Dha Newsletter 2011Uploaded byAnamta
- 17MIS7072 abhibus.pdfUploaded byDUGGINENI SAI ANIRUDH
- uahengo_estimating_2014 (1).pdfUploaded byCarlos Soler