Title: Signal Processing Using MATLAB
1Signal Processing Using MATLAB
2Introduction
- Any signal can be represented as a sum of
different sinusoids. - The signals we are interested in Metrology, like
surface finish, are no different from other
signals found in nature, like voltages, currents
etc. - We use Fourier transform to convert the time
domain signal (like surface finish) into the
frequency domain where we can relate specific
frequency bands to its sources. Our signals are
spatial, i.e, a function of distance in space.
3Sampled data
y4
y3
Y(um) 12.2 13.4 15.5 14.6 12.8
y2
yn
y1
spacing
If the data is surface finish data, then we know
that X(0,1,2,3,4)spacing (in um or mm)
4Data representation
- Sampled data is a sequence of numbers
- We have to deal with arrays/matrices of numbers
- Surface finish array of numbers represent the
relative heights of points on a surface - CMM matrix represents (x,y,z) coordinates of
different points
5Square Wave
(1/1)sin(2pi1x) (1/3)sin(2pi3x) (1/5)sin(2p
i5x) (1/7)sin(2pi7x) (1/9)sin(2pi9x)
6Fourier Series
F(x) (1/1)sin(2pi1x) (1/3)sin(2pi3x)
(1/5)sin(2pi5x) (1/7)sin(2pi7x)
(1/9)sin(2pi9x)
We have generated a square wave by adding
different sine waves. These sine waves have
different amplitudes and wavelengths. The
reverse is the Fourier series - Any signal can be
decomposed into many sine waves Each sine wave
is characterized by its amplitude and
wavelength(or frequency) The input signal is
time-dependant or is said to be in time domain
7Fourier Transform
- Fourier Transform is the process of transforming
a signal from time-domain to frequency domain. - In this example,
Amplitude and Wavelength of Different sine waves
That make up the signal
Fourier Transform
F(x) Square wave
8(No Transcript)
9lamda1
A1,lamda1
A2,lamda2
A3,lamda3
180 deg
90
270
90
180
270
360
Sampling interval
0 deg
10Sampling in terms of wavelength
- The larger the sampling interval, the more
information we lose in other words, we cannot
capture sinusoids whose wavelengths are smaller
than the sampling interval - If you know the smallest wavelength you are
interested in capturing, then your sampling
interval should be half that wavelength shannon
sampling theorem - All measuring instruments have a certain default
sampling interval, below which we cannot go.
11Filters in Metrology
- Filters we need in Metrology follow the same
basic idea. - What are going to filter?
- Surface profiles
- Roundness data
- Cylindricity data
- Why do we need to filter data
- To suppress noise
- Extract the trends in data
12What exactly are we going to filter
- Any signal can be represented as sum of different
sine waves fourier theorem - Square wave F(x) (1/1)sin(2pix/1)
(1/3)sin(2pix/3) (1/5)sin(2pix/5)
(1/7)sin(2pix/7) (1/9)sin(2pix/9) - Just as the sand particle is characterized by it
size, a continuous time signal is characterized
by the wavelengths of the different sinusoids
that make up this signal - So, the goal our filter is to allow some of the
sinusoids to pass through, while blocking the
others
13Output signal has only some of those
wavelengths Output(x) (A1,lamda1)
Input containing sinusoids of many Wavelengths F
(x) (A1,lamda1) (A2,lamda2)
Filter
The filter has suppressed the other sinusoids
(A2,lamda2)
14How do you filter a signal?
- There are two general approach to filters
- The intuitive way to this would be in the
frequency domain - Time domain convolution is another way to filter
signals
15Filtering in Frequency domain
Input signal In time domain
Look at the FFT and suppress all wavelengths
you do not want
FFT
Take the inverse FFT
Filtered output
16An example generating a data set that has known
wavelengths
- Generate a signal that has two sine waves
superimposed on them
17y 1sin(2pix/2) 0.5sin(2pix/0.5)
18Suppress the FFT
19Suppress the FFT
20Inverse FFT
21To summarize
- We started with
- this signal
- Took the FFT of
- the signal
- Suppress fft
- did inverse fft
22Filter window
- When we suppressed the FFT, we multiplied the FFT
array by a bunch of 0s and 1s. This array of
0s and 1s is the filter window, commonly called
as the filter. - The width of the filter (the number of 1s) is
the cutoff of the filter
23FFT Using MATLAB
- Type help fft for Fourier transform
- Type help ifft for inverse Fourier transform
- gtgt spacing 1/1000 in mm
- gtgt length 8 in mm
- gtgt X (0spacinglength-spacing)
- gtgt Y1 sin(2pi.X/2)
- gtgt plot(X,Y1)
- gtgt title('A sine wave data')
- gtgt xlabel('mm')
- gtgt ylabel('um')
- gtgt myFFT(X,Y1)
24(No Transcript)
25- gtgt Y2 sin(2pi.X)
- gtgt myFFT(X,Y2)
26(No Transcript)
27- gtgt Y3 Y1 Y2
- gtgt myFFT(X,Y3)
28(No Transcript)
29- gtgt Y4 Y1 0.5Y2
- gtgt myFFT(X,Y4)
30(No Transcript)
31Example
- Consider a surface profile obtained from a sine
wave artifact. Let us assume that data points
were collected from a surface finish instrument
over a trace of 8mm with a spacing of 1um. Let
the points be collected so that the spacing
between adjacent points be 1um. - gtgt spacing 1/1000
in mm - gtgt length 8
in mm - gtgt X (0spacinglength-spacing)
- gtgt Y sin(2pi.X)
- Let us now do the FFT
- gtgt F fft(Y)
- gtgt size(F) You will
notice that F is of the same length as Y, 8000
points in this case
32What do you observe?
- 1. The first term is always the DC term
- 2. The wavelengths decrease from the second term
to the mid and then increases again. Since there
is a repetition, we can discard the second half
of the result. - 3. The largest wavelength we can measure is the
length of measurement itself (in this case, 8mm) - 4. The smallest wavelength we can capture is
twice the sampling interval (21um).
33HW