Escola Federal de Engenharia de Itajubá



Similar documents
Soving Recurrence Relations

In nite Sequences. Dr. Philippe B. Laval Kennesaw State University. October 9, 2008

Cooley-Tukey. Tukey FFT Algorithms. FFT Algorithms. Cooley

Sequences and Series

CHAPTER 3 DIGITAL CODING OF SIGNALS

FOUNDATIONS OF MATHEMATICS AND PRE-CALCULUS GRADE 10

Infinite Sequences and Series

Trigonometric Form of a Complex Number. The Complex Plane. axis. ( 2, 1) or 2 i FIGURE The absolute value of the complex number z a bi is

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES

Modified Line Search Method for Global Optimization

Normal Distribution.

Class Meeting # 16: The Fourier Transform on R n

Fast Fourier Transform and MATLAB Implementation

Now here is the important step

S. Tanny MAT 344 Spring be the minimum number of moves required.

Your organization has a Class B IP address of Before you implement subnetting, the Network ID and Host ID are divided as follows:

I. Chi-squared Distributions

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Example 2 Find the square root of 0. The only square root of 0 is 0 (since 0 is not positive or negative, so those choices don t exist here).

Confidence Intervals for One Mean

Basic Measurement Issues. Sampling Theory and Analog-to-Digital Conversion

CHAPTER 3 THE TIME VALUE OF MONEY

Basic Elements of Arithmetic Sequences and Series

Department of Computer Science, University of Otago

3. Greatest Common Divisor - Least Common Multiple

A Combined Continuous/Binary Genetic Algorithm for Microstrip Antenna Design

1 Correlation and Regression Analysis

INFINITE SERIES KEITH CONRAD

Properties of MLE: consistency, asymptotic normality. Fisher information.

Chapter 7 Methods of Finding Estimators

CS103A Handout 23 Winter 2002 February 22, 2002 Solving Recurrence Relations

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies ( 3.1.1) Limitations of Experiments. Pseudocode ( 3.1.2) Theoretical Analysis

Convexity, Inequalities, and Norms

Systems Design Project: Indoor Location of Wireless Devices

Fast Fourier Transform

Chapter 5 Unit 1. IET 350 Engineering Economics. Learning Objectives Chapter 5. Learning Objectives Unit 1. Annual Amount and Gradient Functions

5.4 Amortization. Question 1: How do you find the present value of an annuity? Question 2: How is a loan amortized?

SEQUENCES AND SERIES

Taking DCOP to the Real World: Efficient Complete Solutions for Distributed Multi-Event Scheduling

Biology 171L Environment and Ecology Lab Lab 2: Descriptive Statistics, Presenting Data and Graphing Relationships

Measures of Spread and Boxplots Discrete Math, Section 9.4

Theorems About Power Series

5 Boolean Decision Trees (February 11)

Cantilever Beam Experiment

WHEN IS THE (CO)SINE OF A RATIONAL ANGLE EQUAL TO A RATIONAL NUMBER?

How To Solve The Homewor Problem Beautifully

GCE Further Mathematics (6360) Further Pure Unit 2 (MFP2) Textbook. Version: 1.4

Partial Di erential Equations

Multiple Representations for Pattern Exploration with the Graphing Calculator and Manipulatives

Incremental calculation of weighted mean and variance

7.1 Finding Rational Solutions of Polynomial Equations

Chapter 6: Variance, the law of large numbers and the Monte-Carlo method

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 13

Overview of some probability distributions.

Repeating Decimals are decimal numbers that have number(s) after the decimal point that repeat in a pattern.

NATIONAL SENIOR CERTIFICATE GRADE 12

2-3 The Remainder and Factor Theorems

A Recursive Formula for Moments of a Binomial Distribution

.04. This means $1000 is multiplied by 1.02 five times, once for each of the remaining sixmonth

Confidence Intervals. CI for a population mean (σ is known and n > 30 or the variable is normally distributed in the.

Lesson 15 ANOVA (analysis of variance)

Week 3 Conditional probabilities, Bayes formula, WEEK 3 page 1 Expected value of a random variable

INVESTMENT PERFORMANCE COUNCIL (IPC)

Research Article Sign Data Derivative Recovery

*The most important feature of MRP as compared with ordinary inventory control analysis is its time phasing feature.

Approximating Area under a curve with rectangles. To find the area under a curve we approximate the area using rectangles and then use limits to find

GCSE STATISTICS. 4) How to calculate the range: The difference between the biggest number and the smallest number.

1. C. The formula for the confidence interval for a population mean is: x t, which was

Overview. Learning Objectives. Point Estimate. Estimation. Estimating the Value of a Parameter Using Confidence Intervals

BENEFIT-COST ANALYSIS Financial and Economic Appraisal using Spreadsheets

Domain 1 - Describe Cisco VoIP Implementations

Lesson 17 Pearson s Correlation Coefficient

APPLICATION NOTE 30 DFT or FFT? A Comparison of Fourier Transform Techniques

CS103X: Discrete Structures Homework 4 Solutions

Exploratory Data Analysis

A Theoretical and Experimental Analysis of the Acoustic Guitar. Eric Battenberg ME

Vladimir N. Burkov, Dmitri A. Novikov MODELS AND METHODS OF MULTIPROJECTS MANAGEMENT

THE ARITHMETIC OF INTEGERS. - multiplication, exponentiation, division, addition, and subtraction

A probabilistic proof of a binomial identity

Baan Service Master Data Management

SAMPLE QUESTIONS FOR FINAL EXAM. (1) (2) (3) (4) Find the following using the definition of the Riemann integral: (2x + 1)dx

Elementary Theory of Russian Roulette

Output Analysis (2, Chapters 10 &11 Law)


Complex Numbers. where x represents a root of Equation 1. Note that the ± sign tells us that quadratic equations will have

hp calculators HP 12C Statistics - average and standard deviation Average and standard deviation concepts HP12C average and standard deviation

1 Computing the Standard Deviation of Sample Means

THE REGRESSION MODEL IN MATRIX FORM. For simple linear regression, meaning one predictor, the model is. for i = 1, 2, 3,, n

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 8

Sequences and Series Using the TI-89 Calculator

How to read A Mutual Fund shareholder report

Lecture 4: Cauchy sequences, Bolzano-Weierstrass, and the Squeeze theorem

The following example will help us understand The Sampling Distribution of the Mean. C1 C2 C3 C4 C5 50 miles 84 miles 38 miles 120 miles 48 miles

Design of Digital Filters

Heat (or Diffusion) equation in 1D*

Chapter 7: Confidence Interval and Sample Size

5: Introduction to Estimation

Chapter 7 - Sampling Distributions. 1 Introduction. What is statistics? It consist of three major areas:

Math 113 HW #11 Solutions

Transcription:

Escola Federal de Egeharia de Itajubá Departameto de Egeharia Mecâica Pós-Graduação em Egeharia Mecâica MPF04 ANÁLISE DE SINAIS E AQUISÇÃO DE DADOS SINAIS E SISTEMAS Trabalho 02 (MATLAB) Prof. Dr. José Juliao de Lima Jr. e-mail: juliao@iem.efei.br home page:www.iem.efei.br/juliao Setembro de 2001

MPF04 Aálise de Siais e Aquisção de Dados 2/14 Ídice 1.1 Itroductio 3 1.2 Project 1: Basic Sigals 4 1.2.1 Exercise: Basic Sigals - Impulses 5 1.2.2 Exercise: Basic Sigals Siusoids 6 1.2.3 Exercise: Sampled Siusoids 7 1.2.4 Exercise: Basic Sigals-Expoetials 9 1.3 Project 2: Complex-Valued Sigals 10 1.3.1 Exercise: Complex Expoetials 12

Itroductio 3/14 Trabalho 02 SINAIS E SISTEMAS 1.1 Itroductio The basic sigals used ofte i digital sigal processig are the uit impulse sigal δ [, expoetials of the form u[, sie waves, ad their geeralizatio to complex expoetials. The followig projects are directed at the geeratio ad represetatio of these sigals i MATLAB. Sice the oly umerical data type i MATLAB is the M x N matrix, sigal must be represeted as vectors: either M x 1 matrices if colum vectors, or 1 x N matrices if row vectors. I MATLAB all sigals must be fiite i legth. This cotrasts sharply with aalytical problem solvig, where a mathematical formula ca be used to represet a ifiite-legth sigal (e. g., a decayig expoetial, a u[ ). a A Secod issue is the idexig domai associated with a sigal vector. MATLAB assumes by default that a vector is idexed from 1 to N, the vector legth. I cotrast, a sigal vector is ofte the result of samplig a sigal over some domai where the idexig rus from 0 to N-1; or, perhaps, the samplig start at some arbitrary idex that is egative, e. g., at N. The iformatio about the samplig domai caot be attached to the sigal vector cotaiig the sigal values. Istead, the user is forced to keep track of this iformatio separately. Usually, this is ot a problem util it comes time to plot the sigal, i which case the horizotal axis must be labeled properly.

MPF04 Aálise de Siais e Aquisção de Dados 4/14 A fial poit is the use of MATLAB's vector otatio to geerate sigals. A sigificat power of the MATLAB eviromet is its high-level otatio for vector maipulatio; for loops are almost always uecessary. Whe creatig sigals such as a sie wave, it is best to apply the si fuctio to a vector argumet, cosistig of all the time samples. I the followig projects, we treat the commo sigals ecoutered i digital sigal processig: impulses, impulse trais, expoetials, ad siusoids. 1.2 Project 1: Basic Sigals This project cocetrates o the issues ivolved with geeratio of some basic discrete-time sigals i MATLAB. Much of the work ceters o usig iteral MATLAB vector routies for sigal geeratio. I additio, a sample MATLAB fuctio will be implemeted. Hits Plottig discrete-time sigals is doe with the stem fuctio i MATLAB. The followig MATLAB code will create 31 poits of a discrete-time siusoid. = 0:30; % vector of time idices sius = si(/2+1); Notice that the = 0 idex must be referred to as (1), due to MATLAB's idexig scheme; likewise, sius(1) is the first value i the siusoid. Whe plottig the sie wave we would use the stem fuctio, which produces the discrete-time sigal plot commoly see i DSP books (see Figura 1.1): stem(,sius ); The first vector argumet must be give i order to get the correct -axis For compariso, try stem(sius) to see the default labelig.

Project 1: Basic Sigals 5/14 1 sie wave 0.8 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8-1 0 5 10 15 20 25 30 Time idex () Figura 1.1 -Pottig a discrete-time sigal with stem. 1.2.1 Exercise: Basic Sigals - Impulses The simplest sigal is the (shifted) uit impulse sigal: 1, = 0 δ[ 0] = (1.1) 0, 0. To create a impulse i MATLAB, we must decide how much of the sigal is of iterest. If the impulse δ [ is goig to be used to drive a causal LTI system, we might wat to see the L poits from = 0 to =L-1. If we choose L = 31, the followig MATLAB code will create a "impulse": L = 31; = 0:(L-1); imp = zeros(l,1); imp(1)=1; Notice that the = 0 idex must be referred to as imp(1), due to MATLAB's idexig scheme. (a). Geerate ad plot the followig sequeces. I each case the horizotal () axis should exted oly over the rage idicated ad should be labeled accordigly. Each sequece should be displayed as a discrete-time sigal usig stem

MPF04 Aálise de Siais e Aquisção de Dados 6/14 x [ = 0.9δ[ 5], 1 20, 1 x [ = 0.8δ[, 15 15, 2 x [ = 1.5δ[ 333], 300 350, 3 x [ = 4.5δ[ + 7], 10 0. 4 (b) The shifted impulse, δ ], ca be used to build a weighted [ 0 impulse trai, with period P ad total legth MP: s[ = M 1 l= 0 Alδ[ l P]. (1.2) The weights are AL; if they are all the same. The impulse trai is periodic with period P. Geerate ad plot a periodic impulse trai whose period is P = 5 ad whose legth is 50. Start the sigal at =0. Try to use oe or two vector operatios rather tha a for loop to set the impulse locatios. How may impulses are cotaied withi the fiitelegth sigal? (c). The followig MATLAB code will produce a repetitive sigal i the vector x. x=[0;1;1;0;0;0]*oes(1,7); x=x(:); size(x) % retur the sigal legth Plot x to visualize its form; the give a mathematical formula similar to equatio (1.2) to describe this sigal. 1.2.2 Exercise: Basic Sigals Siusoids Aother very basic sigal is cosie wave. I geeral, it takes three parameters to describe a real siusoidal sigal completely: amplitude (A), frequecy (Ω0), ad phase (φ). x [ = Acos( Ω0 + φ) (1.3)

Project 1: Basic Sigals 7/14 (a). Geerate ad plot each of the followig sequeces. Use MATLAB's vector capability to do this with oe fuctio call by takig the cosie (or sie) of a vector argumet. I each case, the horizotal () axis should exted oly over the rage idicated ad should be labeled accordigly. Each sequece should be displayed as a sequece usig stem. π x1[ = si( ), 17 0 25, π x2[ = si( ), 17 15 25, π x3[ = si(3π + ), 2 10 10, x4[ = cos( π ), 23 0 50. Give a simpler formula for x3[ that does ot use trigoometric fuctios. Explai why x4[ is a ot periodic sequece. (b). Write a MATLAB fuctio that will geerate a fiite-legth siusoid. The fuctio will eed a total of five iput argumets: three for the parameters ad two more to specify the first ad last idex of the fiite-legth sigal. The fuctio should retur the result a colum vector that cotais the values of the siusoid. Test this fuctio by plottig the results for various choices of the iput parameters. I particular, show how to geerate the sigal 2si( π /11) for 20 20. (c). Modificatio: Rewrite the fuctio i part (b) to retur two argumets: a vector of idices over the rager of, ad the values of the sigal. 1.2.3 Exercise: Sampled Siusoids Ofte a discrete-time sigal is produced by samplig a cotiuous-time sigal such as a costat-frequecy sie wave. The relatioship betwee the cotiuos-time frequecy ad the samplig frequecy is mai poit of

MPF04 Aálise de Siais e Aquisção de Dados 8/14 Nyquist-Shao samplig theorem, which requires that samplig frequecy be at least twice the highest frequecy i the sigal for perfect recostructio. I geeral, a cotiuos-time siusoid is give by the followig mathematical formula: s ( t) = Acos(2πf0t + φ) (1.4) where A is the amplitude f0 is the frequecy i Hertz, ad φ is the iitial phase. If a discrete-time sigal is produced by regular samplig of s(t) at a rate of fs=1/t, we get f 0 s[ = s( t) = Acos(2πf T + φ = A π + φ t= T 0 s ) cos 2 (1.5) f s Compariso with formula (1.4) for a discrete-time siusoid, x[=acos(ω0+φ), shows that the ormalized radia frequecy is ow a scaled versio of f0, Ω0=2π(f0Ts). (a). From formula (1.3) for the cotiuous-time siusoid, write a fuctio that will geerate samples of s(t) to create a fiite-legth discrete-time sigal. This fuctio will require six iputs: three for the sigal parameters, two for the start ad stop times, ad oe for samplig rate (i Hertz). It ca call the previously writte MATLAB fuctio for the discrete-time siusoid. To make the MATLAB fuctio correspod to the cotiuous-time sigal defiitio, make the uits of the start ad stop times secods ot idex umber. Use this fuctio to geerate a sample siusoid with the followig defiitio: Sigal freq= 1200 Hz Samplig freq = 8 KHz Iitial Phase= 45 deg Startig Time= 0 s Amplitude = 50 Edig Time = 7 ms

Project 1: Basic Sigals 9/14 Make two plots of the resultig sigal: oe as a fuctio of time t (i millisecod), ad the other as a fuctio of the sample idex used i t=ts. Determie the legth of the resultig discrete-time sigal ad the umber of periods of the siusoid icluded i the vector. (b). Show by mathematical maipulatio that samplig a cosie at the times t = +3/4 T will result i a discrete-time sigal that appears to be a sie wave whe f0 = 1/T. Use the fuctio from part (a) to geerate a discrete-time sie wave by chagig the start ad stop times for the samplig. 1.2.4 Exercise: Basic Sigals-Expoetials The decayig expoetial is a basic sigal i DSP because it occurs as the solutio to liear costat-coefficiet differece equatios. (a). Study the followig MATLAB fuctio to see how it geerates a discrete-time expoetial sigal. The use the fuctio to plot the expoetial x [ = (0.9) over the rage = 0,1, 2,..., 20. fuctio y = geexp(b,0,l) %GENEXP geerate a expoetial sigal: b^ % usage: y = geexp(b,0,l) % b iput scalar givig ratio betwee terms % 0 startig idex (iteger) % L legth of geerated sigal % y output sigal y(1:l) if(l<= 0) error('genexp: legth ot positive') ed =0+[1:L]'-1; %---vector of idices y=b.^; ed (b). I may derivatios,the expoetial sequece a u[ must be summed over a fiite rage. This sum is kow i closed form: L 1 = 0 a L 1 a = 1 a, for a 1 (1.6)

MPF04 Aálise de Siais e Aquisção de Dados 10/14 Use the fuctio from part (a) to geerate a expoetial ad the sum it up; compare the result to formula (1.6). (c). Oe reaso the expoetial sequece occurs so ofte i DSP is that time shiftig does ot chage the character of the sigal. Show that the fiite-legth expoetial sigal satisfies the shiftig relatio: y[ = ay[ 1] over the rage1 L 1 (1.7) By comparig the vectors y(2 :L) ad a *y(1:l-1). Whe shiftig fiitelegth sigals i MATLAB, we must be careful at the edpoits because there is o automatic zero paddig. (d). Aother way to geerate a expoetial sigal is to use a recursive formula give by a differece equatio. The sigal y[=a u[ is the solutio to the followig differece equatio whe the iput, x[, is a impulse: y[ ay[ 1] = x[ iitial coditio : y[ 1] = 0 (1.8) Sice the differece equatio is assumed to recurse i a causal maer (i. e., for icreasig ), the iitial coditios at =-1 is ecessary. I MATLAB the fuctio filter will implemet a differece equatio. Use filter to geerate the same sigal as i part (a) (i. e., a = 0.9). 1.3 Project 2: Complex-Valued Sigals This project ceters o the issues ivolved with represetig ad geeratig complex-valued sigals. Although i the real world, sigals must have real values, it is ofte extremely useful to geerate, process, ad iterpret real-valued sigal pairs as complex-valued sigals. This is doe by combiig the sigals ito a pair, as the real ad imagiary parts of a complex umber, ad processig this pair with other complex-valued sigals

Project 2: Complex-Valued Sigals 11/14 usig the rules of complex arithmetic. Use of sigal pairs i this way is a importat part of may sigal processig systems, especially those ivolvig modulatio. Complex expoetials are a class of complex sigals that is extremely importat because the complex amplitude (phasor otatio) provides a cocise way to describe siusoidal sigals. Most electrical egieerig studets are familiar with phasors i coectio with ac circuits or power systems, but their use i radar, wave propagatio, ad Fourier aalysis is just as sigificat (although the term phasor is ot always used). Hits I MATLAB, the fuctios real ad imag will extract the real ad imagiary parts of a complex umber. Whe plottig a complex vector, the defaults for plot ad stem ca be cofusig. If z is complex, the plot(z) will plot the imagiary part versus the real part; ad plot(,z) will plot the real part of z versus. However, stem(z) will just plot the real part. If you wat to view simultaeous plots of the real ad imagiary parts, the subplot(211) ad subplot(212) commads prior to each stem commad will force the two plots to be placed o the same scree, oe above the other. See Figura 1.2, which was created usig the followig code: = 0:25; xx = exp(j*/3); %--- complex expoetial subplot (211) stem(,real(xx)) title('real PART'), xlabel('index ()') subplot (212) stem(,imag(xx)) title('imag PART'), xlabel('index ()')

MPF04 Aálise de Siais e Aquisção de Dados 12/14 1 REAL PART 0.5 0-0.5-1 0 5 10 15 20 25 INDEX () 1 IMAG PART 0.5 0-0.5-1 0 5 10 15 20 25 INDEX () Figura 1.2 - Plottig Real ad Imagiary Parts of a Discrete-Time Sigal with subplot 1.3.1 Exercise: Complex Expoetials The real expoetial otatio ca be exteded to complex-valued expoetial sigals that embody the sie ad cosie sigals. These sigals form the basis of the Fourier trasform. (a). I MATLAB a complex sigal is a atural extesio of the otatio i Exercise 1.4. Thus the parameters a ca be take as a complex umber to geerate these sigals. Recall Euler's formula for the complex expoetial (i a form that gives a sigal): x[ = ( z 0 ) = e (l Z + j z ) jθ 0 0 = r e = r (cosθ + jsiθ ) (1.9) where zo=re jθ =r θ. Use this relatioship to geerate a complex expoetial with z0= 0.9 45. Plot the real ad imagiary parts of x[ over the rage 0 20. Notice that the agle of z0 cotrols the frequecy of the siusoids. (b). For the sigal i part (a) make a plot of the imagiary part versus the real part. The result should be a spiral. Experimet with differet agles for θ - a smaller value should produce a better picture of a spiral. (c). Equatio (1.9) is ot geeral eough to produce all complex expoetials. What is missig is a complex costat to scale the

Project 2: Complex-Valued Sigals 13/14 amplitude ad phase of the siusoids. This is the so-called phasor otatio: jφ jθ j( θ+φ) G. z0 = Ae r e = Ar e = Ar [cos( θ + φ) + jsi( θ + φ)], (1.10) where G = A e jφ = A φ is the complex amplitude of the complex expoetial. Geerate ad plot each of the followig sequeces. Covert the siusoids to complex otatio; the create the sigal vector usig exp. If the sigal is purely real, it should be geerated by takig the real part of a complex sigal. I each plot, the horizotal () axis should exted oly over the rage idicated ad should be labeled accordigly. π π x1[ = 3si( ) + j4cos( ), 0 20, 7 7 π x2[ = si( ), 15 25, 17 π π x3[ = 1.1 si( + ), 0 50, 11 4 π x4[ = 0.9 cos( ), 10 20. 11 For each sigal, determie the values of amplitude ad phase costats that have to be used i G; also the agle ad magitude of zo. (d). These same complex expoetials ca be geerated by first-order differece equatios (usig filter): y [ = z0 y[ 1] + x[. (1.11) The filter coefficiet, z0=re jθ, is a complex umber. The ratio betwee successive terms i the sequece is easily see to be z0; but the correct amplitude ad phase must be set by choosig a complex amplitude for the impulse which drives the differece equatio (i. e., x[ = Gδ[). Use filter to create the same sigals as i part (c). Verify by plottig both the

MPF04 Aálise de Siais e Aquisção de Dados 14/14 real ad imagiary parts of y[ ad comparig to the sigals geerated via exp. (e). I the first-order differece equatio (1.11), let yr[ ad yi[ deote the real ad imagiary parts of y[. Write a pair of real-valued differece equatios expressig yr[ ad yi[ i terms of yr[-1], yi[- 1], x[ ad r, cosθ, ad siθ. (f). Write a MATLAB program to implemet this pair of real equatios, ad use this program to geerate the impulse respose of equatio (1.11) for r = 1/2 ad θ = 0, ad θ = π/4. For these two cases, plot the real part of the impulse resposes obtaied. Compare to the real part of the output from the complex recursio (1.11).