Title: MATLAB MATRIX LABORATORY
1??? ?????? ????? ?MATLAB
??? ??? ?????? ????????
2- Course Syllabus
- First Day
- About Signal Processing Toolbox Signals and
Filters Fourier Transforms Individual
Practicing - Second Day
- Introduction to Graphical User Interface of the
Signal Processing ToolboxlSignal BrowserFilter
ViewerDesigneSpectrum ViewerIndividual
Practicing - Literature
- A.Biran, M.Breiner.Matlab 5 for Engineers,
Addison-Wesley, Reading, MA, 1999.
- Course Destination
- Course is destined for non-programmers engineers
and scientists who whish to gain primary skills
in using Signal Processing Toolbox of Matlab. - Prerequisites
- Primary skill in Matlab is required.
- Course organization
- Two morning sessions in three academic hours
each, including individual practicing. Examples
will be performed in real time by the lecturer
and by the students. - Bonus Those who wish can receive home task or
propose and solve any problem which would check
by lecturer. - Minor modifications may take place.
31.????? ????? ?MATLAB
- ????? ??????
- 1. ????? ????? ?MATLAB
- - Signal Processing Toolbox
- - ????? ????????
- - ????? ?????? ????? ??????
- 2. ???? ?Signal Processing GUI - sptool
- - Signal Browser
- - Filter ViewerDesigner
- - Spectrum Viewer
- 3. ????? ?????? ??? ?SPTool
- - ????? ???
- - ???? ????? ?????? ??? ?????
- - ????? ?????? ????? ?? ??????
41.1 Signal Processing Toolbox
- SPT ?? ???? ?200 ???????? ?GUI ????
- ????? ????? ???????? ? ?????????
- ????? ??????????? ?? ????? ??????????
- ???? ?????? FIR ?IIR
- ????? ????
- ???? ?????? ??? 5.1
- (???? ???? 20.12.2001)
51.1 ????? ????????
- ????? ?? ????? ????? (??) ?Matlab ??????
- ???? ????? ???? ???? ??? ??
- ???? ?????? m ?????? ???? m ??????
- ????? ??????? ?? sinusoid , unit impulse ,
- unit step , and unit
ramp - ???????
- t(00.0011)'ynsin(2pi50t)0.5randn(size(
t)) - plot(t(150),yn(150)),grid on, , siniusoid
at 50 Hz - y1zeros(99,1) plot(t(110),y(110)), unit
impuls - yones(100,1)plot(t(1100),y(1100)), unit
step (filter assumes 0 initial cond.) - yt unit ramp
- yt.2 try to plot
- ysquare(4t)plot(t(11000),y(11000)) try to
plot
61.1 ????? ???????? (????)
- ?? ??? ???? ??? ??? ?? ????? ????. ?????? ????
?MATLAB ????? ??????? filter - filter(B,A,x) ?? filter(B,A,x,Zi)
- ???? B,A ?? ?????? ?????? ??????? ?????
- Ynb1/a1x1 bnb/anbx?-a2/a1yn-1-ana/a1yn-na
1 - ? Zi ????? ?? initial conditions ?? ?
- Yn Zib1/a1x1 bnb/anbx1-a2/a1yn-1-ana/a1y
n-na1 - ??????
- signal x consists of two sinusoids, one at 50
Hz and one at 120 Hz - Fs100t01/Fs1xsin(2pit50).25sin(2pi
t120) - signal has white noise normally distributed
- xnx0.5randn(size(t))
- yfilter(0.5,1,-0.25,-0.25,x) non-init
cond. filter with b0.5 - and a1,a2,a3 are 1, -0.25 and -0.25
- plot(t,x,t,y,'--'),grid on
71.1 ????? ???????? (????2)
- Digital Filter Difference Equation
- Y(z) b1 b2z-1 bn z-(n-1) /a1 a2 z-1
an z -(n-1) X(z), - X - input signal
- Y - output signal
- z ejwT
- T- period
- a,b - coefficients
- (denominator, numerator)
- n - order of filter
- If a2, a3, ,an 0 the filter is called
- FIR (finite impulse response)
- Otherwise - IIR (infinite impulse response)
81.1 ????? ???????? (????3)
- Digital Filter Specifications
Passband ripple,Rp
Stopband ripple,Rs
A,dB20log10A
91.1 ????? ???????? (????4)
- ??????? ???????
- ???? ?????? ?DSP ??? - ????? ????? ??
- ????? m ????? f???????
- ?????? IIR ?FIR ??????? ?????? ???????? MATLAB
??????? ?????? ???? ??????? - ????? y ??? ???????
- ??????
- b,aYulewalk(n,f,m) IIR, least square fit in
time domain - bFirls(n,f,m) least square linear phase
FIR - Y,wFreqz(b,a,n) frequency response Y and
frequencies w for after filtering - ???? n ??? ?? ?????
- ??????? ???? ???
101.1 ????? ???????? (????5)
- ?????(????)
- desired filter characteristics
- fHz0 100 150 200 225 250m1 1 .5 .5 1 1
n6 - fs500b,ayulewalk(n,fHz/(fs/2),m) b and
a to IIR, fs/2-the Nyquist f - y1,w1freqz(b,a,128) signal after filtering
- plot(fHz/(fs/2),m,w1/pi,abs(y1))
- bbfirls(n,fHz/(fs/2),m) b to FIR
- y2,w2freqz(bb) signal after filtering
- plot(fHz/(fs/2),m,w1/pi,abs(y1), w2/pi,abs(y2))
111.1 ????? ???????? (????6)
- ???????
- ???? ????? ???? ???? ??? FIR ???? 8 ?????? ????
?????, ??? ?????? ??? ??? ?? ???????? - ???? ????? ???? ???? ??? IIR ???? 8 ?????? ????
?????, ??? ?????? ??? ??? ?? ???????? - ??? ??? ????? ?? ??? ??????? ?? ????? 100 ?400
Hz ,????? 0.1s...0,??? ????? 2000 Hz - ??? low-pass ?high-pass ??????? , ????? ?
- ????? f00, 225, 275, 1000Hz
- ?????????? m1,1,0,0 ???? low-pass ?????
- ?m0,0,1,1 ???? high-pass ?????
- ???? ?????? ?? ?????
- ???? ????? ??????? yulewalk ?? n6 ?filter
121.2 ????? ?????? ????? ??????
- ????? ????? ???????? DFT ????? ??????? FFT
- Fast Fourier Transform- ?? ?????? ?? ?????
?????. - ?????? ?????? ????? ??? ??? ???? x ????????????
??? X ??? -
- ?????? ?????? ????? ??? ??? ???? x ????????????
??? X ???
131.2 ????? ?????? ????? ?????? (????)
- ?????? fft ? ifft
- fft(x,n)
- Ifft(x,n),
- where x is vector or rectangular array
- n (optionally) is number of points for
transform - ??????
- ?? 1/99?? ???? ????? ??? xsin(2p15t)sin(2p40t
) - ????? ?????? ?????
- t(01/991)xsin(2pi15t)sin(2pi40t)
- yfft(x) f(0length(y)-1)99/length(y)
- plot(f,abs(real(y))),grid on
- ???? ???? ???
141.2 ????? ????? ????? ?????? (????2)
- ????? ?????? ????? ????? ?? ?????? ??????
- x1real(ifft(y))
- plot(t,x,t,x1,'o'),grid on
Reconstructed points
15 2. ???? ?Signal Processing GUI
- ?SPTOOLBOX GUI ?????
-
- ????? ????????????
- ????? ?????????? ???????
- ????? ?????? ????????
- ?????? (Transforms)
- ????? ?? ?????????
- ????? ???? ????? ??????
16.2 ???? ?Signal Processing GUI (????)
- SPTool ????
- Signal Browser for viewing, measuring and
- analyzing the time-domain information
of signals - Filter ViewerDesigner for design and editing
IIR and FIR filters with standard
(lowpass, highpass, bandpass,)
configurations for viewing the
characteristics - of designed or imported filters
- Spectrum Viewer for graphical analysis of
frequency-domain data using of
spectral estimation methods
17 2 ???? ?Signal Processing GUI (????2)
- ???? GUI ?? SPToolbox- ????? sptool
- sptool
182.1 Signal Browser
- ???? ? Import ?????? File ???? ???? ? Input to
SPTool ? - ???? ? ?Import As ???? Signal
- ???? ?? From Disk ??? ????? ?? ?? ???? ???????
,???? mtlb.mat
192.1 Signal Browser(????2)
- ?File Contents ?????? ??????
- mtlb (radio signal data) ?Fs (sampling
frequencies) - ??????? mtlb ?Data ?Fs ? Sampling Frequency
- ???? ??OK ????? ????? ????? sig1 ????? ?????
???? ????? View ????? SPTool
202. 2 Filter ViewerDesigner
- ??? ??New Design ????? SPTool ???? ???? Filter
Designer - ???? ???? Keiser Window ?Algorithm ?Bandpass
?Type - ????? SPTool ??? Edit-gtSampling
Frequences-gtFilt1-gtEnter Sampling Frequencies ???
??? ????? Hz 2000
212.2 Filter ViewerDesigner (????)
- ?????? ?Passband ??Stopband Fp175 Fp2110
Fs150 Fs2130 Rp4 ?
Rs30 - ??? Apply ???? ????, ??? ?????? ????
Pass Band Region
Passband
Stopband frequencies
222.2 Filter ViewerDesigner ????? ???? IIR ?????
- ???? 'Chebyshev type1' highpass????? ???? 7
- ??? ????? 2000 Hz
- fp700Hz fs800Hz Rp2.5DB Rs35DB
- ??? ???? ???? ????? ????? Pass ??? ?????? ??
?????
232.3.Spectrum Viewer
- ????View ??? ???? Spectra? SPTool
- ????? Spectrum Viewer ?? PSD(Power Spectral
Density) - ?? input data
- ??? ????? ????
- Spectrum Viewer
- ????? ????? Welch
- ?????? ?????? ????????
-
PSD Power Spectral Density
????? ????? ?????? ?????????
242.3.Spectrum Viewer (????)
- ??? ????? ???? ????? ?? ??????? ???? ????? ????
????? ?? ??? ????? ?????. - ???????????? ??
- ??????? ???????
- ??????? ???????
- Revert
- ?????? ???????
- Apply
- ?????? ????????
253. ????? ?????? ??? ?SPTool
- ?????? ?????
-
- 1. ????? ???
- 2. ???? ????? ?????? ??? ?????
- 3. ????? ?????? ????? ?? ??????
- 4. ????? ????????? ?? ??? ??????
26 3.1 ????? ???
- ????? ??? ????? ?? ??? ?????
- xrandn(5000,1)
- ????? ?? ????? ?? SPTool ??? ?? File -gt Import
- ???? For Workspace ????? ?signal ?'Import As '
- X ? Data?500 ? Sampling Frequency
- ?? ?? noise ?Name
- OK
273.2 ???? ????? ?????? ??? ?????
- ???? ?? New Design ????? ?? Filter Designer ??
????? filt1 - ???? ?? ??? ?????? ?5000 SPTool -gt Edit -gt
Frequency Sampling -gt 5000 -gt OK - ?Filter Designer ???? Equiripple ?Algorithm
?Bandpass ?Type - ?? 750 ? 1250 ?Pass 500 ?1500 ? Stopband?0.01
?75 ?Rp ? Rs
???? ???? ?????
?????? ?????
283.3 ????? ?????? ????? ?? ??????
- ????? ?????? ????? filt1 ?????? ??? noise ?????
SPTool - ???? noise ?filt1 ????? Apply ?????? Filters
?Apply Filter box ???? Output Signal ?????
blnoise ?OK. ?????? ????? blnoise - ??? ?????? ??? ????? shift-click filt1 blnoise
?View ?Signals - ?Selection ???? blnoise ??Color ??? Green
?????
293.4 ?????? ????????? ?? ??? ??????
- ???? SPTool , ???? noise ?Signals ???? Create
?Spectra - ?Spectrum Viewer ???? Apply, ?????? Spectra ?????
???? spect1 . - ????? ???? ??????? ???? spect2 ???? ??? noise.
- ?Spectra ?? SPTool ?????? ?spect1 ?spect2 ??????
?? View
spect1
spect2
30???? 1 ????? ???????? ???????? ??????
- abs
- grid on
- fft
- filter
- fir
- firls
- freqz
- gid on
- Ifft
- length
- ones
- plot
randn real sin size sptool yulewalk
31???? 2 ????? (?????) ?? ???????? ?? Signal
Processing Toolbox
- Filter analysis
- abs - Magnitudeangle - Phase anglefreqs -
Laplace transform frequency responsefreqspace -
Frequency spacing for frequency responsefreqz -
Z-transform frequency response - FIR Filter Design
- fir1 - Window based FIR filter design - low,
high, band, stop, multifir2 - FIR arbitrary
shape filter design using the frequency sampling
methodfirls - Optimal least-squares FIR filter
design - IIR Digital Filter Design
- butter - Butterworth filter designellip -
Elliptic filter designyulewalk - Yule-Walker
filter design - IIR Filter Order Estimation
- buttord - Butterworth filter order estimation
32???? 2 ????? (?????) ?? ???????? ?? Signal
Processing Toolbox
- Transforms
- fft - Fast Fourier transformfft2 - 2-D fast
Fourier transformfftshift - Swap vector
halvesifft - Inverse fast Fourier
transformifft2 - Inverse 2-D fast Fourier
transform - Statistical Signal Processing and Spectral
Analysis - corrcoef - Correlation coefficientscsd -
Cross Spectral Densitypburg - Power Spectral
Density estimate via Burg's methodpcov - Power
Spectral Density estimate via the Covariance
methodrootmusic - Sinusoid frequency and power
estimation via the MUSIC algorithm - Graphical User Interfaces
- fdatool - Filter Design and Analysis
Toolsptool - Signal Processing Tool