Practical signal processing using matlab


Published on

Published in: Technology

Practical signal processing using matlab

  1. 1. Professional Development Short Course On: Practical Statistical Signal Processing — using MATLAB Instructor: Dr. Steven KayATI Course Schedule: Practical Statistical Signal Processing: 349 Berkshire Drive • Riva, Maryland 21140 888-501-2100 • 410-956-8805 Website: • Email:
  2. 2. Practical Statistical Signal Processing Using MATLAB with Radar, Sonar, Communications, Speech & Imaging Applications June 22-25, 2009 Middletown, Rhode Island $1895 (8:30am - 4:00pm) "Register 3 or More & Receive $10000 each Off The Course Tuition." Course Outline 1. MATLAB Basics. M-files, logical flow, graphing, debugging, special characters, array manipulation, Summary vectorizing computations, useful toolboxes. This 4-day course covers signal processing 2. Computer Data Generation. Signals, Gaussian systems for radar, sonar, communications, speech, noise, nonGaussian noise, colored and white noise, imaging and other applications based on state-of- AR/ARMA time series, real vs. complex data, linear the-art computer algorithms. These algorithms models, complex envelopes and demodulation. include important tasks such as data simulation, 3. Parameter Estimation. Maximum likelihood, parameter estimation, filtering, interpolation, best linear unbiased, linear and nonlinear least detection, spectral analysis, beamforming, squares, recursive and sequential least squares, classification, and tracking. Until now these minimum mean square error, maximum a posteriori, algorithms could only be learned by reading the general linear model, performance evaluation via Taylor latest technical journals. This course will take the series and computer simulation methods. mystery out of these designs by introducing the 4. Filtering/Interpolation/Extrapolation. Wiener, algorithms with a minimum of mathematics and linear Kalman approaches, time series methods. illustrating the key ideas via numerous examples using MATLAB. 5. Detection. Matched filters, generalized matched filters, estimator-correlators, energy detectors, Designed for engineers, scientists, and other detection of abrupt changes, min probability of error professionals who wish to study the practice of receivers, communication receivers, nonGaussian statistical signal processing without the headaches, approaches, likelihood and generalized likelihood this course will make extensive use of hands-on detectors, receiver operating characteristics, CFAR MATLAB implementations and demonstrations. receivers, performance evaluation by computer Attendees will receive a suite of software source simulation. code and are encouraged to bring their own laptops 6. Spectral Analysis. Periodogram, Blackman- to follow along with the demonstrations. Tukey, autoregressive and other high resolution Each participant will receive two books methods, eigenanalysis methods for sinusoids in noise. Fundamentals of Statistical Signal Processing: Vol. I 7. Array Processing. Beamforming, narrowband and Vol. 2 by instructor Dr. Kay. A complete set of vs. wideband considerations, space-time processing, notes and a suite of MATLAB m-files will be interference suppression. distributed in source format for direct use or 8. Signal Processing Systems. Image processing, modification by the user. active sonar receiver, passive sonar receiver, adaptive noise canceler, time difference of arrival localization, channel identification and tracking, adaptive Instructor beamforming, data analysis. Dr. Steven Kay is a Professor of Electrical 9. Case Studies. Fault detection in bearings, Engineering at the University of acoustic imaging, active sonar detection, passive sonar Rhode Island and the President of detection, infrared surveillance, radar Doppler estimation, speaker separation, stock market data Signal Processing Systems, a analysis. consulting firm to industry and the government. He has over 25 years of research and development What You Will Learn experience in designing optimal • To translate system requirements into algorithms statistical signal processing algorithms for radar, that work. sonar, speech, image, communications, vibration, • To simulate and assess performance of key and financial data analysis. Much of his work has algorithms. been published in over 100 technical papers and • To tradeoff algorithm performance for the three textbooks, Modern Spectral Estimation: computational complexity. Theory and Application, Fundamentals of • The limitations to signal processing performance. Statistical Signal Processing: Estimation Theory, • To recognize and avoid common pitfalls and traps and Fundamentals of Statistical Signal in algorithmic development. Processing: Detection Theory. Dr. Kay is a Fellow • To generalize and solve practical problems using of the IEEE. the provided suite of MATLAB code.Register online at or call ATI at 888.501.2100 or 410.956.8805 Vol. 97 – 41
  3. 3. www.ATIcourses.comBoost Your Skills 349 Berkshire Drive Riva, Maryland 21140with On-Site Courses Telephone 1-888-501-2100 / (410) 965-8805Tailored to Your Needs Fax (410) 956-5785 Email: ATI@ATIcourses.comThe Applied Technology Institute specializes in training programs for technical professionals. Our courses keep youcurrent in the state-of-the-art technology that is essential to keep your company on the cutting edge in today’s highlycompetitive marketplace. Since 1984, ATI has earned the trust of training departments nationwide, and has presentedon-site training at the major Navy, Air Force and NASA centers, and for a large number of contractors. Our trainingincreases effectiveness and productivity. Learn from the proven best.For a Free On-Site Quote Visit Us At: Our Current Public Course Schedule Go To:
  4. 4. References1∗. S. Kay, Fundamentals of Statistical SignalProcessing: Estimation Theory, Prentice-Hall, 19932∗. S. Kay, Fundamentals of Statistical SignalProcessing: Detection Theory, Prentice-Hall, 19983. L. Scharf, Statistical Signal Processing, Addison-Wesley,Reading, MA, 1991 (more advanced treatment)4. R.N. McDonough, A.D. Whalen, Detection ofSignals in Noise, Academic Press, New York, 19955. H.L. Van Trees, Detection, Estimation, andModulation Theory, Vol. I, J. Wiley, New York, 1968(fairly involved but a classic)6. G.M. Jenkins, D.G. Watts, Spectral Analysis and itsApplications, Holden-Day, 19687. S. Kay, Modern Spectral Estimation: Theory andApplication, Prentice-Hall, 19888. M.B. Priestley, Spectral Analysis and Time Series,Academic Press, 19819. R.A. Monzingo, T.W. Miller, Adaptive Arrays, J.Wiley, 198010. D.H. Johnson, D.E. Dudgeon, Array SignalProcessing, Prentice-Hall, 1993∗ Provided as part of course materials
  5. 5. Summary of Slides Slide number1. Matlab Basics 4 -162. Computer Data Generation 17 - 493. Parameter Estimation 50 - 1074. Detection 108 - 1825. Spectral Analysis 183 - 2086. Array Processing 209 - 2227. Case Studies 223 - 2478. Description of MATLAB Programs 248 - 253
  6. 6. MATLAB BasicsVersion: 5.2 for WindowsUseful toolboxes: signal processing, statistics, symbolicm files: script filesFortran vs. MATLAB example:Signal generation Math: s[n ] = cos(2π f 0n ) n = 0,1, K, N − 1Fortran: pi=3.14159 f0=0.25 N=25 do 10 I=1,N 10 s(I)=cos(2*pi*f0*(I-1))MATLAB: f0=0.25;N=25; s=cos(2*pi*f0*[0:N-1]’);
  7. 7. Notes: pi already defined, [0:N-1]’ is a column vector,cosine of vector of samples produces a vector output,MATLAB treats vectors and matrices as elements
  8. 8. Noise GenerationSimplest model for observation noise is white Gaussiannoise (WGN)Definition: zero mean, all samples are uncorrelated,power spectral density (PSD) is flat, and first order probability density function (PDF) isGaussian exp ⎛ − 2 x 2 ⎞ 1 1PDF: p( x ) = ⎜ ⎟ ⎝ 2σ p(x ) 2πσ 2 ⎠where σ 2 = variance xMATLAB Example: σ2 = 1 4 2 ] 0 n [ x -2 -4 0 20 40 60 80 100 n wgn.m 0 25 0 1 f o 20 t u o s 15 e m o c 10 t u o f 5 o r e b 0 m u -3 -2 -1 0 1 2 3 n x
  9. 9. wgn.m 1 0.9 0.8 0.7 0.6 ) x ( p 0.5 , F D P 0.4 0.3 0.2 0.1 0 -3 -2 -1 0 1 2 3 xNote: randn(‘state’,0) sets random number generator to default seed and thus generates the same set of random numbers each time the program is run.MATLAB code:% wgn.m%% This program generates and plotsthe time series, histogram, and
  10. 10. % estimated PDF for real whiteGaussian noise.randn(state,0)x=randn(100,1);subplot(2,1,1)plot(x)xlabel(n)ylabel(x[n])gridsubplot(2,1,2)hist(x)xlabel(x)ylabel(number of outcomes out of100)title(wgn.m)figurepdf(x,100,10,-3,3,1)xlabel(x)ylabel(PDF, p(x))title(wgn.m)% pdf.m%functionpdf(x,N,nbins,xmin,xmax,ymax)%
  11. 11. % This function subprogram computesand plots the% PDF of a set of data.%% Input parameters:%% x - Nx1 data array% N - number of data points% nbins - number of bins (<N/10)% xmin,xmax,ymax - axis scaling% [y,xx]=hist(x(1:N),nbins); delx=xx(2)-xx(1); bar(xx,y/(N*delx)) grid axis([xmin xmax 0 ymax]);
  12. 12. Complex White Gaussian NoiseDefinition: x [n ] = w1[n ] + jw2 [n ]where w1[n ] and w2 [n ] are independent of each otherandeach one is real WGN with variance of σ 2 / 2Mean: E (x [n ]) = 0Variance: var(x [n ]) = var(w1[n ]) + var(w 2 [n ]) = σ 2MATLAB code:% cwgn.m%% This program generates complexwhite Gaussian noise and% then estimates its mean andvariance.%N=100;varw=1;x=sqrt(varw/2)*randn(N,1)+j*sqrt(varw/2)*randn(N,1);muest=mean(x)varest=cov(x)
  13. 13. NonGaussian NoiseGeneration: transform WGN using a nonlinearmemoryless transformationExample: Laplacian noise 1 ⎛ 2 ⎞ p( x ) = exp ⎜ − 2 x ⎟ 2σ 2 ⎝ σ ⎠Use the transformation x = F −1 (w )where w is uniform random variable on the interval[0,1]and F is the cumulative distribution function of theLaplacianPDF. F (x ) 1 x
  14. 14. Example: σ 2 = 1 5 ] 0 n [ x -5 0 200 400 600 800 1000 n laplaciannoise.m 1 0.8 ) x 0.6 ( p , F 0.4 D P 0.2 0 -5 0 5 x
  15. 15. MATLAB Code:% laplaciannoise.m%% This program uses a memorylesstransformation of a uniform% random variable to generate a setof independent Laplacian% noise samples.% rand(state,0) varx=1;N=1000; u=rand(N,1); for i=1:N if u(i)>0.5x(i,1)=sqrt(varx)*(1/sqrt(2))*log(1/(2*(1-u(i)))); elsex(i,1)=sqrt(varx)*(1/sqrt(2))*log(2*u(i)); end end subplot(2,1,1) plot(x) xlabel(n) ylabel(x[n])
  16. 16. axis([0 1000 -5 5]);subplot(2,1,2)pdf(x,N,50,-5,5,1)title(laplaciannoise.m)
  17. 17. Solving Parameter Estimation ProblemsApproach:1. Translate problem into manageable estimationproblem2. Evaluate best possible performance (bounds)3. Choose optimal or suboptimal procedure4. Evaluate actual performance a. Analytically – exact or approximate b. By computer simulation
  18. 18. Radar Doppler Estimation (Step 1)Problem: Given radar returns from automobile,determine speed to within 0.5 mph transmitPhysical basis: Doppler effect receive – receive- approaching moving away
  19. 19. Received frequency is 2v F = F0 + F0 c { FDwhere v = velocity, c= speed of light, F0 = sinusoidaltransmitfrequencyTo measure the velocity use c F − F0 v = 2 F0and estimate the frequency to yield c F − F0 ˆ v = ˆ 2 F0
  20. 20. Modeling and Best Possible Performance (Step 2)Preprocessing: first demodulate to baseband to producethesampled complex envelope or s [n ] = (A / 2) exp( j 2π FD n ∆ + ϕ ) % ⎛ F = 2v F ⎞ ⎜ D ⎟ ⎝ c 0⎠ Fs = 1/ ∆ > 2FD = 2 ⎛ max F0 ⎞ 2vMust sample at ⎜ ⎟ ⎝ c ⎠Example: v max =300 mph, F0 =10.5 Ghz (X-band), c = 3x108 m/s 2v max FD −max = F0 ≈ 9388 Hz c ⇒ Fs > 18, 776 complex samples/secHow many samples do we need?Spec: error must be less than 0.5 mph for
  21. 21. (A / 2)2 SNR = 10 log10 > −10 dB σ 2 Cramer-Rao Lower Bound for Frequency• tells us the minimum possible variance for estimator – very useful for feasibility studies 6var( fD ) ≥ ˆ (*) (see [Kay 1988]) (2π )2ηN (N 2 − 1)where fD = FD / Fs , N = number of complex samples,η =linear SNR cFsSince FD = (2v / c )F0 ⇒ v = fD 2F0and we can show that 2 ⎛ cFs ⎞ var(v ) = ⎜ ˆ ˆ ⎟ var( fD ) ⎝ 2F0 ⎠For an error of 0.5 mph (0.22 m/s) set
  22. 22. 3 var(v ) = 0.22 ⇒ var( fD ) = 7.47x10 −8 ˆ ˆ 99.8% ˆ v v − 0.5 v v + 0.5and finally we have from (*) that 1/ 3 ⎡ 6 ⎤ N >⎢ ≈ 272 samples ˆ )⎥ ⎢ (2π ) η var( fD ⎥ 2 ⎣ ⎦
  23. 23. Descriptions of MATLAB Programs1. analogsim – simulates the action of an RC filter on apulse2. arcov - estimates the AR power spectral densityusing he covariance method for AR parameterestimation for real data.3. arexamples - gives examples of the time series andcorresponding power spectral density for various ARmodels. It requires the function subprograms:gendata.m and armapsd.m.4. armapsd - computes a set of PSD values, given theparameters of a complex or real AR or MA or ARMAmodel.5. arpsd - plots the AR power spectral density for somesimple cases. The external subprogram armapsd.m isrequired.6. arpsdexample - estimates the power spectral densityof two real sinusoids in white Gaussian noise using theperiodogram and AR spectral estimators. It requires the functions subprograms: per.m andarcov.m.
  24. 24. 7. arrivaltimeest - simulates the performance of anarrival time estimator for a DC pulse. The estimator isa running correlator which is the MLE for whiteGaussian noise.8. avper - illustrates the effect of block averaging onthe periodogram for white Gaussian noise.9. classicalbayesian - demonstrates the differencebetween the classical approach and the Bayesianapproaches to parameter modeling.10. cwgn - generates complex white Gaussian noise andthen estimates its mean and variance.11. DClevelhist - generates Figures 1.4, 1.5 in"Fundamentals of Statistical Signal Processing:Detection Theory", S. Kay12. DCleveltime - generates a data set of whiteGaussian noise only and also a DC level A in whiteGaussian noise13. discretesinc – plots the graph in linear and dBquantities of a discrete sinc pulse in frequency
  25. 25. 14. estperform - compares the frequency estimationperformance for a single complex sinusoid in complexwhite Gaussian using the peak location of theperiodogram and an AR(1) estimator.15. Fig35new - computes Figure 3.5 (same as Figure4.5) in "Fundamentals of Statistical Signal Processing:Detection Theory", S. Kay. The function subprogramsQ.m and Qinv.m are required.16. Fig39new - computes Figure 3.9 in "Fundamentalsof Statistical Signal Processing: Detection Theory", S.Kay. The function subprograms Q.m and Qinv.m arerequired.17. Fig77new - computes Figure 7.7 in "Fundamentalsof Statistical Signal Processing: Detection Theory", S.Kay.18. gendata - generates a complex or real AR, MA, orARMA time series given the filter parameters andexcitation noise variance.19. kalman - implementation of the vector state-scalarobservation linear Kalman filter. See (13.50)-(13.54) of"Fundamentals of Statistical Signal Processing:Estimation Theory" by S. Kay for more details.
  26. 26. 20. kalmanexample - uses the linear Kalman filter toestimate the tap weights for a random TDL channel. Itgenerates Figures 13.16-13.18 in "Fundamentals ofStatistical Signal Processing: Estimation Theory", S.Kay. It requires the function subprogram kalman.m.21. laplaciannoise - uses a memoryless transformationof a uniform random variable to generate a set ofindependent Laplacian noise samples.22. linearmodel - computes the optimal estimator ofthe parameters of a real or complex linear model.Alternatively, it is just the least squares estimator.23. linearmodelexample - implements a line fit to anoise corrupted line. The linear model or least squaresestimator is used. The function subprogramlinearmodel.m is required.24. MAexample – plots out the PDF of an MA process25. mlevar - computes the mean, variance, PDF of theMLE for the power of a WGN process and compares itto the CRLB.26. montecarloroc - uses a Monte Carlo approach todetermine the detection performance of a Neyman-Pearson detector for a DC level in WGN. The true
  27. 27. performance is shown in "Fundamentals of StatisticalSignal Processing: Detection Theory", S. Kay, in Figure3.9 for d^2=1. The function subprogram roccurve.m isrequired.27. pcar - estimates the frequencies of real sinusoidsby using the principal component AR approach. Futherdetails can be found in "Modern Spectral Estimation:Theory and Application", by S. Kay.28. pdf - computes and plots the PDF of a set of data.29. per - computes the periodogram spectral estimator. Futher details can be found in "Modern SpectralEstimation: Theory and Application", by S. Kay.30. perdetectexample - illustrates the detectionperformance of a periodogram, which is an incoherentmatched filter.31. perexamples - illustrates the capability of theperiodogram for resolving spectral lines.32. plot1 – plots a sinusoid33. psk - implements a matched filter receiver for thedetection of a PSK signal. The data are assumed real.
  28. 28. 34. pskexample - illustrates the optimaldetection/decoding of a PSK encoded digital sequence.The bits are decoded and the probability of error iscomputed and compared to the number of actual errors.The external function subprogram psk.m is required.35. Q - computes the right-tail probability(complementary cumulative distribution function) for aN(0,1) random variable.36. Qinv - computes the inverse Q function or thevalue which is exceeded by a N(0,1) random variablewith a probability of x.37. repcorr - implements a replica correlator for eitherreal or complex data.38. repcorrexample - illustrates the replica-correlator.It requires the subprogram repcorr.m.39. roccurve - determines the ROCs for a given set ofdetector outputs under H0 and H1.40. sampling – plots out an analog sinusoid and thesamples taken41. seqls - implements a sequential least squaresestimator for a DC level
  29. 29. in WGN of constant variance.42. shift - shifts the given sequence by a specifiednumber of samples. Zeros are shifted in either fromthe left or right.43. signdetexample - implements a sign detector for aDC level in Gaussian-mixture noise. A comparison ismade to a replica correlator, which is just the samplemean.44. sinusoid - generates a sinusoid45. stepdown - implements the step-down procedure tofind the coefficients and prediction error powers for allthe lower order predictors given the filter parametersand white noise variance of a pth order AR model. See(6.51) and (6.52). This program has been translatedfrom Fortran into Matlab. See "Modern SpectralEstimation" by S. Kay for further details.46. timedelaybfr - implements a time delaybeamformer for a line array of 3 sensors. The emittedsignal is sinusoidal and is assumed to be at broadside or at 90 degrees (perpendicular to line array).
  30. 30. 47. wgn - generates and plots the time series,histogram, and estimated PDF for real white Gaussiannoise.48. wiener - implements a Wiener smoother forextracting an AR(1) signal in white Gaussian noise andalso for predicting an AR(1) signal for no observationnoise present.
  31. 31. Boost Your Skills with On-Site Courses Tailored to Your Needs The Applied Technology Institute specializes in training programs for technical professionals. Our courses keep you current in the state-of-the-art technology that is essential to keep your company on the cutting edge in today’s highly competitive marketplace. For 20 years, we have earned the trust of training departments nationwide, and have presented on-site training at the major Navy, Air Force and NASA centers, and for a large number of contractors. Our training increases effectiveness and productivity. Learn from the proven best. ATI’s on-site courses offer these cost-effective advantages: • You design, control, and schedule the course. • Since the program involves only your personnel, confidentiality is maintained. You can freely discuss company issues and programs. Classified programs can also be arranged. • Your employees may attend all or only the most relevant part of the course. • Our instructors are the best in the business, averaging 25 to 35 years of practical, real- world experience. Carefully selected for both technical expertise and teaching ability, they provide information that is practical and ready to use immediately. • Our on-site programs can save your facility 30% to 50%, plus additional savings by eliminating employee travel time and expenses. • The ATI Satisfaction Guarantee: You must be completely satisfied with our program. We suggest you look at ATI course descriptions in this catalog and on the ATI website. Visit and bookmark ATI’s website at for descriptions of all of our courses in these areas: • Communications & Computer Programming • Radar/EW/Combat Systems • Signal Processing & Information Technology • Sonar & Acoustic Engineering • Spacecraft & Satellite Engineering I suggest that you read through these course descriptions and then call me personally, Jim Jenkins, at (410) 531-6034, and I’ll explain what we can do for you, what it will cost, and what you can expect in results and future capabilities. Our training helps you and your organization remain competitive in this changing world.Register online at or call ATI at 888.501.2100 or 410.531.6034