Upload
anonymous-oirgnbkthn
View
217
Download
1
Embed Size (px)
DESCRIPTION
castel
Citation preview
SPECTRUM ESTIMATION
Tudor AVRAM Madalina MOISAUniversitatea Tehnică din Cluj-Napoca, Bulevardul 21 Decembrie 1989 128-130, Cluj-Napoca
Tel. 0264-401223 Fax: 0264-591689 e-mail: [email protected]
Abstract: The goal of this project is to present the DSK6713 and its uses in spectrum estimation. The spectrum is estimated using three methods, The Burg method, The modified covariance method and the periodogram method and to compare the results with a reference
spectrum.
1. IntroductionIn this chapter we will use the DSK6713 for
spectrum estimation. Three estimation methods will
be implemented:
i. Periodogram
ii. Burg
iii. M-Cov
1.1. Periodogram
The Periodogram block computes a nonparametric
estimate of the spectrum. The block averages the
squared magnitude of the FFT computed over
windowed sections of the input and normalizes the
spectral average by the square of the sum of the
window samples.
1.2.The Modified Covariance Method
The Modified Covariance Method block estimates
the power spectral density (PSD) of the input using
the modified covariance method. This method fits
an autoregressive (AR) model to the signal by
minimizing the forward and backward prediction
errors in the least squares sense. The order of the
all-pole model is the value specified by the
Estimation order parameter. To guarantee a valid
output, you must set the Estimation order parameter
to be less than or equal to two thirds the input
vector length. The spectrum is computed from the
FFT of the estimated AR model parameters.
1.3.Burg Method
The Burg Method block estimates the power
spectral density (PSD) of the input frame using the
Burg method. This method fits an autoregressive
(AR) model to the signal by minimizing (least
squares) the forward and backward prediction
errors while constraining the AR parameters to
satisfy the Levinson-Durbin recursion.
2. Simulation
2.1.The Environment Figure 1 shows the data flow for the Estimation
simulation. The input signal for the estimator is an
AR process generated by feeding an all-poles filter
with white noise. The AR coefficients generate the
reference spectrum to be compared against the
estimated one.
Figure 1- Spectrum Estimation Simulation
2.2.The Procedure1. Create a new model in Simulink® and name
it: “SpectrumEstimation.mdl”
2. Open the Simulink library browser and add a
random source object:
Figure 2- The Random Source Object
3. Double click on the random source object,
and configure its parameters to fit the white
noise characteristics we want to achieve:
Figure 3- The Random Source Object Configuration
4. Add a new digital filter to the model:
Figure 4- The Digital Filter Block
5. Double-click on the filter and fill in the
following parameters1
Figure 5- The Digital Filter Block Parameters
6. Add the 3 estimators: Periodogram, Burg and
Modified-Covariance to your model:
Figure 6- The Burg Method Block
7. Configure the FFT length of the three models to 128:
1 The Auto-Regressive process is represented by an
all-pole IIR filter. The AR coefficients are the ones in
the “Denominator coefficients” label.
Figure 7- FFT Length Configuration for Spectrum Estimation2
8. Add a new constant to your model:
Figure 8- The "DSP Constant" Block
9. This constant will have the AR coefficients
values:
Figure 9- The AR coefficients values
2 The same configuration parameters apply for the three models.
10. Add a magnitude FFT block in order to get
the spectrum from the AR coefficients:
Figure 10- The FFT Block11. Set the FFT length to 128:
Figure 11- The FFT Length12. Add a new math function object:
Figure 12- The Math Function Block
The “Math Function” block should be configured to calculate the reciprocal:
Figure 13- The Math Function Block Configuration
13. Add a new gain to your model (to represent
the white noise variance in the reference
spectrum generation) and set its value to 0.1:
Figure 14- The Gain Block
14. In order to display the Real and Estimated
spectra simultaneously, you need to add a
new concatenate object:
Figure 15- The "Matrix Concatenate" Block
and set the number of inputs of the concatenation
object to 4:
Figure 16- The "Matrix Concatenate" Block Configuration
15. The various spectra will be displayed in a
vector scope:
Figure 17- The "Vector Scope" Block
Select frequency as its input domain:
Figure 18- The "Vector Scope" Block Configuration
16. Connect the blocks as shown in Figure 19:
Figure 19 – Spectrum Estimation Simulation Model
17. When running the model3, you should see the
get the following display:
Figure 20 – Comparing the various spectrum estimators
3 You should select a different color for each channel
3. Real Time Implementation
3.1.The EnvironmentFigure 21 shows the block-diagram for the real
time implementation. The DSP will deliver two
outputs. The first is the reference spectrum; the
second is an estimated spectrum of the output of
the all-pole filter. Three real-time models will be
created, each one corresponding to an estimator.
The user will be able to select the desired estimator
through a Graphic User Interface (GUI).
Figure 21- Real Time Implementation Environment
The real-time implementation model will be
created from the simulation model, after the
following changes:
The noise generator block will be replaced
by the CODEC of the DSK6713
The virtual scope will be replaced also by
the CODEC
A target definition block (DSK6713) will
be added.
Equipment Used:
DSK6713
Dual Channel Oscilloscope
Signal Generator
Figure 22- Spectrum Estimation Equipment
3.2.Creating the Models1. Open the simulation model
“SpectrumEstimation.mdl”.
2. Remove the “Burg” and “MCov AR”
estimators.
3. Add the C6713DSK target to the model
Figure 23- The C6713DSK target Block
4. Replace the vector scope by the “Digital to
Analog” converter (DAC)
Figure 24- The DAC Block
5. Configure the DAC block to a sampling rate
to 8 KHZ and 16-bit samples.
Figure 25- The DAC Block Configuration
6. Double- click on the concatenation object
and change the number of inputs from 4 to 2.
7. Replace the white noise generator by the
“Analog to Digital” converter (ADC).
Figure 26- The ADC Block
8. Configure the ADC blocks to a sampling
rate to 8 KHZ and 16-bit samples.
Figure 27- The ADC Block Configuration
The final model should look as follows:
Figure 28 –Periodogram Real-Time Model
9. Set the AR-coefficients data type to single.
10. Configure the Model to generate and build
(without executing) the CCS code as shown:
Figure 29 –Model Configuration
11. Save the model as “Periodogram.mdl”
12. Build the model (CTRL-B)
13. Replace the Periodogram estimator block by
the Burg estimator
14. The final model should look as follows:
Figure 30 –Burg Real-Time Model
18. Save the model as “Burg.mdl”
19. Build the model (CTRL-B)
20. Replace the Burg estimator block by the
MCov AR estimator
21. The final model should look as follows:
Figure 31 –MCov ARBurg Real-Time Model
22. Save the model as “MCcov_AR.mdl”
15. Build the model (CTRL-B)
At this step you’ll have three .out files to be
loaded to the DSK. Each one corresponding to an
estimator.
3.3.The Graphic User Interface (GUI)
The GUI shown in Figure 32 will be used to select
the model. Upon selecting a model, its
correspondent load file will be loaded to the DSP.
Figure 32- GUI
1. Enter GUIDE in the MATLAB® command
line.
2. Choose a new GUI, and name it Spectrum
3. Add a list-box to your GUI with the string:
4. A script file “spectrum.m” will open, when
you press the “play” button. Name the
script “spectrum.m”
5. The GUI will perform two tasks:
i. Upon activating the GUI, the
default model is loaded to the
DSP.
ii. When the user selects a new
model, it is loaded to the DSP.
6. The initialization routine
“Spectrum_OpeningFcn” will be:
function Spectrum_OpeningFcn(hObject, eventdata, handles, varargin)modelName = gcs;%connect to target:CCS_Obj = connectToCCS(modelName);% Identify RTDX channel names/modesCodegenDir = fullfile(pwd, ['Periodogram' '_c6000_rtw']);OutFile = fullfile(CodegenDir, ['Periodogram' '.out']);%load the model to the DSK:CCS_Obj.load(OutFile,20);handles.CCS_Obj=CCS_Obj;handles.output = hObject;%remember the current model:handles.last_model=1;CCS_Obj.run;% Update handles structureguidata(hObject, handles);
7. Selecting a new model:
%1. halts the current model%2. loads the current model%inputs:%m - 3 levels flag that tells which model to load.%CCS_Obj - the target objectfunction ChangeModel(m,CCS_Obj)CCS_Obj.halt;switch m case 1 model='Periodogram'; case 2 model='Burg'; case 3 model= 'MCov_AR';endCodegenDir = fullfile(pwd, [model '_c6000_rtw']);OutFile = fullfile(CodegenDir, [model '.out']);CCS_Obj.load(OutFile,20);CCS_Obj.run; if last_y~=15000r.writemsg(chan_struct(2).name,1/last_y);
end
8. When the user changes the model, the list-box handler function is invoked:
function listbox1_Callback(hObject, eventdata, handles)handles.last_model=get(hObject,'Value') ;ChangeModel(handles.last_model,handles.CCS_Obj);guidata(hObject, handles);
The handler saves the new model as the current
model and invokes the change model function we
described above.
Now you can run the model, and observe the results in the oscilloscope for the various estimators.
PeriodogramBurgM-Cov