## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Introduction to Symbolic Computation

Spring 2007

**MATLAB Lecture 7. Signal Processing in MATLAB
**

We have seen how to ﬁt data with polyﬁt and how to design shapes with spline. In this lecture we cover another way to deal with approximate data, which is well suited for treating signals [1].

7.1 Fourier Transforms

Every signal can be written as a sum of sinusoids with diﬀerent amplitudes and frequencies. The MATLAB command to compute the Fourier Transform and its inverse are respectively ﬀt and iﬀt, for example: >> >> >> >> >> x = rand(1,10); y = fft(x); iy = ifft(y); x2 = real(iy); norm(x-x2); % % % % % suppose 10 samples of a random signal Fourier transform of the signal inverse Fourier transform chop off tiny imaginary parts compare original with inverse of transformed

The ﬀt is the abbreviation of Fast Fourier Transform. This algorithm implements the discrete Fourier transform to transform data from time into the frequency domain. The study of this algorithm is normally covered in a good linear algebra course. First we give an example of the meaning of the Fourier transform before showing how Fourier transforms can be used to ﬁlter noise from signals.

**7.2 Waveform and Amplitude Spectrum
**

Suppose we sample a signal during 4 seconds, at a sampling rate of 0.01: >> >> >> >> dt = 1/100; et = 4; t = 0:dt:et; y = 3*sin(4*2*pi*t) + 5*sin(2*2*pi*t); % % % % sampling rate end of the interval sampling range sample the signal

A natural plot is that of amplitude versus time: >> >> >> >> >> subplot(2,1,1); plot(t,y); grid on axis([0 et -8 8]); xlabel(’Time (s)’); ylabel(’Amplitude’); % % % % % first of two plots plot with grid adjust scaling time expressed in seconds amplitude as function of time

With the Fourier Transform we can visualize what characterizes this signal the most. From the Fourier transform we compute the amplitude spectrum: >> Y = fft(y); >> n = size(y,2)/2; >> amp_spec = abs(Y)/n; % compute Fourier transform % 2nd half are complex conjugates % absolute value and normalize

To visualize the amplitude spectrum, we execute the following commands >> >> >> >> >> subplot(2,1,2); freq = (0:79)/(2*n*dt); plot(freq,amp_spec(1:80)); grid on xlabel(’Frequency (Hz)’); ylabel(’Amplitude’); % % % % % second of two plots abscissa viewing window plot amplitude spectrum 1 Herz = number of cycles/second amplitude as function of frequency

On the amplitude spectrum we see two peaks: at 2 and 4. The location of the peaks occurs at the two frequencies in the signal. The heights of the peaks (5 and 3) are the amplitudes of the sines in the signal. Jan Verschelde, 23 April 2007 UIC, Dept of Math, Stat & CS MATLAB Lecture 7, page 1

>> ifY = ifft(fY).1.1. >> >> >> >> >> noise = randn(1. ey = y + noise. The command ﬁx rounds the elements of its argument to the nearest integers towards zero. amp_spec = abs(eY)/n. % scale axes for viewing xlabel(’Time (s)’).2). The wobbles we see around the peaks show that the amplitude of the noise is less than that of the original signal. % amplitude as function of time subplot(2. Note we can also remove noise of high frequency. grid on axis([0 et -8 8]). % % % % % new window for plot plot corrected signal adjust scale for viewing time expressed in seconds amplitude as function of time Here we ﬁltered out noise of low amplitude.2)). ylabel(’Amplitude’).cy). we use ﬁx to set all elements in eY less than 100 to zero: >> fY = fix(eY/100)*100. grid on % plot amplitude spectrum xlabel(’Frequency (Hz)’). % 1 Herz = number of cycles per second ylabel(’Amplitude’). xlabel(’Time (s)’). % % % % % random noise samples with noise Fourier transform of noisy signal use size for scaling compute amplitude spectrum To interpret these calculations we make a plot of the waveform and amplitude spectrum: >> >> >> >> >> >> >> >> >> >> >> figure % plots in new window subplot(2. % amplitude as function of frequency On the ﬁrst plot we recognize the shape of the signal. eY = fft(ey).size(y. grid on % plot noisy signal with grid axis([0 et -8 8]).2)/2. we ﬁlter out the noise. ﬁnally we plot this corrected signal: >> >> >> >> >> figure plot(t. % first of two plots plot(t. the peaks and their heights are the same as on the plot of the amplitude spectrum of the original signal. n = size(ey. First we add random noise to our signal and compute the amplitude spectrum. Stat & CS MATLAB Lecture 7. Dept of Math.amp_spec(1:80)). % set numbers < 100 to zero % inverse Fourier transform of fixed data % remove imaginary parts The vector cy contains the corrected samples. % second of two plots freq = (0:79)/(2*n*dt). We can visualize the output of the Fourier transforms: >> >> >> >> figure plot(Y/n. % time expressed in seconds ylabel(’Amplitude’).ey).’bx’) % % % % new window for plot Fourier transform of original put more on same plot Fourier transform of noisy signal Via the inverse Fourier transform.1). Jan Verschelde. In the plot of the amplitude spectrum.3 Filtering Noise from Signals We will see now how to use ﬀt and iﬀt to ﬁlter out the noise from signals. page 2 . >> cy = real(ifY). % abscissa viewing window plot(freq. 23 April 2007 UIC. So.MCS 320 Introduction to Symbolic Computation Spring 2007 7.’r+’) hold on plot(eY/n. For this example.

References [1] S. 23 April 2007 UIC. hold on. As noise we now add a sine of amplitude 4 and with frequency 50. Why is the output of the second plot like this? Find a better range for t to plot sin(20*pi*t) right. The function has prototype: function specplot ( t. Dept of Math. For the abscissa viewing window you may take half of the range of t. y2 = sin(20*pi*t). plot the waveform spectrum of this signal. Use ﬀt and iﬀt to remove this high frequency noise.1:10. 4. Plot the waveform and amplitude spectrum of the new signal. plot(t. dt.MCS 320 Introduction to Symbolic Computation Spring 2007 7. Stearns and R. David.A. Signal Processing Algorithms in MATLAB. Consider the following sequence of instructions: >> >> >> >> >> >> t = 0:0. In addition. page 3 . 3. % So specplot computes the amplitude spectrum of the signal. 1996.D. With ﬀt we can decompose a signal in low and high frequencies. Jan Verschelde. Stat & CS MATLAB Lecture 7.y1). plot(t. Test your specplot with the signal of the previous assignment. % y samples of the signal over the range t. % dt sampling rate. y ) % % Opens a new figure window with two plots: % the waveform and amplitude spectrum of a signal. Can you ﬁnd a good lower bound for the sampling interval in terms of the frequency? 2. Prentice Hall. % et end of the range. % % On entry : % t sampling range of the signal. y1 = sin(2*pi*t). Take the example signal from page 1. Make a function to plot waveform and amplitude spectrum of a signal. et. Give the MATLAB commands to plot the amplitude spectrum for the signal 20 f (t) = k=10 (20 − k) sin(2πkt).4 Assignments 1.y2).

- 00700_TransformParseval
- Code
- Convolução e Espectro
- 375 Lab Report 2
- Lect4&5
- Project
- SAC Tutorial 5
- Technical Review_ No. 1 1984 _Dual Channel FFT Analysis (Part I)_ (BV0013)
- matlec7
- RR210402-SIGNALS----SYSTEMS
- Matlab Signal
- Report
- FFT
- Question Bank 3_2013-14
- Pengolahan Sinyal Digital B 2011 2012 01
- Basic of Convolution an Wavelet
- Properties of Fourier Series - GATE Study Material in PDF
- Generation of Random Road Profiles.pdf
- c10a Characterisation of Seismic Motion
- Stofat_UM
- Comparative Study of detecting Speech Using End Point Detection
- Lecture 13
- 110007466329
- Pipeline Calculations
- Spatial variation of seismic ground motions.pdf
- spectral estimation assignment
- EENG5610_Chap1.pptx
- omnic.pdf
- 4.5
- Wavelets in Geodesy and Geodynamics

- Fault Diagnostics of Rolling Bearing based on Improve Time and Frequency Domain Features using Artificial Neural Networks
- tmpE088
- tmp1F0F.tmp
- 68676_2000-2004
- tmpA072
- tmp7214
- tmp3D7C.tmp
- Features Extraction From Speech For Emotion Recognition.
- tmp3F02
- tmpB2E7.tmp
- Noise Analysis on Indoor Power Line Communication Channel
- tmpA063.tmp
- tmp1F9E
- A Review on Multi-Focus Image Fusion Algorithms
- A Comparative Analysis of the Filter Bank Spectrum Sensing methods for Cognitive Radio a Brain Empowered Technology
- tmp16DC.tmp
- tmp5D58
- As 60068.2.64-2003 Environmental Testing Tests - Test Fh- Vibration Broad-band Random (Digital Control) and g
- Approximation of Gaussian derivatives for UWB communication
- tmp803F
- frbclv_wp1991-16.pdf
- Designing of a Feature Extraction model for Manipuri Language
- Spectrum Sensing
- tmp8645.tmp

- UT Dallas Syllabus for ce3302.001.10s taught by Charles Bernardin (cpb021000)
- tmpF2BE
- UT Dallas Syllabus for ee3302.001.08f taught by Andrea Fumagalli (andreaf)
- tmpE827
- UT Dallas Syllabus for ce3102.103.11f taught by Bo Ram Kim (bxk105120)
- UT Dallas Syllabus for ee3302.001.07s taught by William Boyd (wwb014000)
- UT Dallas Syllabus for ce3302.0u1.10u taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for te3302.001.07f taught by Andrea Fumagalli (andreaf)
- UT Dallas Syllabus for math6319.501 05f taught by Viswanath Ramakrishna (vish)
- UT Dallas Syllabus for te3302.001.09s taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for te3302.001.10s taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for te3302.002.08f taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for ce3302.001.09s taught by Charles Bernardin (cpb021000)
- tmpB2E7.tmp
- UT Dallas Syllabus for te3302.501.07f taught by Philipos Loizou (loizou)
- tmp91F4
- UT Dallas Syllabus for ee3302.001.09s taught by Charles Bernardin (cpb021000)
- Voice to Command Converter
- UT Dallas Syllabus for ee3102.104.11f taught by Bo Ram Kim (bxk105120)
- UT Dallas Syllabus for te3302.0u1.10u taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for te3302.002.09f taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for te3302.002.07s taught by Andrea Fumagalli (andreaf)
- UT Dallas Syllabus for engr3302.001.10f taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for ee3302.0u1.10u taught by Charles Bernardin (cpb021000)
- Waveform Dictionaries as Applied to the Australian Exchange Rate
- UT Dallas Syllabus for ce3302.001.10s taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for ce3302.002.09f taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for te3302.001.10s taught by Charles Bernardin (cpb021000)
- UT Dallas Syllabus for ee4361.021 06u taught by P Rajasekaran (pkr021000)
- UT Dallas Syllabus for ee3302.001.10s taught by Charles Bernardin (cpb021000)

Sign up to vote on this title

UsefulNot usefulClose Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Close Dialog## This title now requires a credit

Use one of your book credits to continue reading from where you left off, or restart the preview.

Loading