Figure 3: Power Spectral Density function

advertisement
MMAN3210
Engineering Experimentation
Laboratory Report No. 5
Tuesday 9-11, Wednesday 1-2
Sam Dimos
z3256932
Aim
The objectives for this laboratory exercise is to generate a Pseudo Random Binary Sequence (PRBS)
and examine the effects of generator parameters; evaluate the autocorrelation and power spectral
characteristics of the Pseudo Random Binary Sequence; and, apply the statistical testing method to
identify the frequency response of a motion system. For the purpose of this experiment, the system
which will be tested is a monorail system.
Introduction
The main process utilised to determine the transfer function, or another mathematical description,
for dynamic characteristics of a system is called system identification. System identification occurs
through the analysis of the input and the output signals, which identifies the relationship their within
the system.
System identification involves a statistical method of identification throughout its processes. Its
application determines the transfer function through on-line testing, which occurs during normal
system operation, as opposed to disturbing operation. This capability allows for the analysis of the
system, without the requirement of ceasing operation, minimising disturbance of the system. This
form of statistical method uses a non-deterministic forcing function which has random
characteristics. In many instances, these random characteristics can be considered as a desired noise
signal. When small enough, the wanted noise signal can become indistinguishable from the normal
input signal.
Method
MATLAB was used in this experiment to create code which was later used to obtain the required
data. The first stage of coding was to create a Pseudo Random Binary Sequences (PRBS), which is a
forcing function that produces an approximation to periodic white noise between the values of +
and -. To achieve this, it was necessary to assign the sequence length through the algebraic
expression L = 2N – 1. The N value within this expression represents the shift stages. This value
needed to be set for the program to obtain a run length. A sampling time was also set to run from 0
to 15 seconds, with 0.1 second time intervals. The PRBS was formed through the use of ‘for’ loops,
and a ‘xor’ logical exclusive function, with its amplitude being bounded between +1 and -1 by a
secondary ‘for’ loop. This PBRS signal is then plotted as shown in figure 1 below.
2
1.5
1
PRBS
0.5
0
-0.5
-1
-1.5
-2
0
2
4
6
8
steps
Figure 1: PRBS with N = 7
10
12
14
Next, the Autocorrelation Function (ACF) is utilised through the MATLAB code ‘xcorr’. The
Autocorrelation Function is designed to correlate the data from the PRBS function. By using the
Autocorrelation Function, the effectiveness of the PRBS in producing random input for the system
can be assessed. As can be seen in figure 2, the Autocorrelation Function illustrates the high
correlation of a value produces a large spike in the graph, while smaller amplitudes illustrate the
decreased correlation in the values from PRBS.
Figure 2: ACF of PRBS values
Following this, a Power Spectral Density (PSD) is required. The Power Spectral Density is a function
which describes the statistical properties of a signal in terms of the frequency, as opposed to the
signal being in terms of ‘time’, as with the Autocorrelation Function. In order to achieve this we are
required to specify the sample frequency of the system which is given by 1/dt. Power Spectral
Density functions are useful in finding Pseudo Random Binary parameters as they provide a
quantitative representation of energy signal distribution across the frequency spectrum within the
system. This can be seen in figure 3 below.
Periodogram Power Spectral Density Estimate
0
Power/frequency (dB/Hz)
-5
-10
-15
-20
-25
-30
0
0.5
1
1.5
2
2.5
3
Frequency (Hz)
3.5
4
Figure 3: Power Spectral Density function
4.5
5
In figure 4 below, a plot of the input signal and output signal has been created. Both pieces of data
form sinusoidal waves, each with individual periods and amplitudes. Figure 5 below illustrates the
frequency response of the monorail system, which is highlighted in red.
5
out
in
4
3
2
1
0
-1
-2
-3
0
2
4
6
8
10
12
14
time
Figure 4: system input / output
20
gain
out
in
0
LogPower
-20
-40
-60
-80
-100
-2
10
-1
10
0
1
10
10
frequency
Figure 5: frequency response
2
10
3
10
Discussion
In examining the Autocorrelation Function plot (figure 2), it becomes evident through the low
random amplitudes that the system demonstrates to us that it receives a sequence of random input
values from the Pseudo Random Binary Sequence, thus highlighting that these inputs are both
independent, and have a low correlation. The Power Spectrum Density plot, provided through figure
3, brings to our attention that the data received is optimal as it shows randomness across the
sequence of data. Figure 3 shows us that the signal oscillates at approximately -7.5dB/Hz.
Through examination of figure 5, we can draw conclusions on the frequency response characteristics
within the system. It is shown that as the frequency in the input and output signals increases, the
system experiences a loss in power. This power drop is evidence of low pass filters presiding within
the system. Low pass filters are filters which permit passage of signals of low frequency, which in
turn minimises the amplitude of any signals that have frequencies above the cut-off frequency. The
monorail system could have many other factors which impede on the frequency response
characteristics of the system, such as due to inertia of the monorail, possible tension in the belt, or
even friction in the track.
Numerous advantages can be drawn about using a statistical method in system identification. Many
of which include the following points:
 Depending on the time intervals used, as well as the N value used, the power of the
noise can be manipulated to fall between a particular frequency band;
 The low intensity signal enables energy spread across a wide frequency range,
further causing minimal disturbance;
 Pseudo Random Binary Sequences are easy to create and work with;
Conclusion
From conducting this experiment, it can be concluded that the Pseudo Random Binary Sequence
used permitted us to generate a frequency response within the system, thus allowing us to operate
the system. The statistical method approach proved to be beneficial in achieving the frequency
response, as it made the process of system operation easier. From our results we can also conclude
that a low pass filter exists within the system, which ultimately restricts the system from exceeding
requirements.
Appendix
function [
] = Lab535( )
N = 7;
iSampleTime = 0.1;
iFinalTime = 15;
L = 2^N - 1;
aShiftArray = ones(1,N);
aPRBS = ones(1,L+1);
xorIndex1 = N - 1;
xorIndex2 = N;
t = 0:iSampleTime:iFinalTime;
zt = length(t);
iPRBS = 1;
for i = 1:zt
iTemp = xor(aShiftArray(xorIndex1),aShiftArray(xorIndex2));
for iMove = max(length(aShiftArray)):-1:2
aShiftArray(iMove) = aShiftArray(iMove - 1);
end
aShiftArray(1) = iTemp;
if( iPRBS < max(length(aPRBS)) )
aPRBS(iPRBS) = iTemp;
iPRBS = iPRBS + 1;
else
break;
end
end
aPRBS(find(aPRBS == 0)) = -1;
figure(1), stairs(t(1:max(length(aPRBS))),aPRBS), axis([0 14 -2 2]);
xlabel('steps');ylabel('PRBS');
corPRBS = xcorr(aPRBS);
trev = -1.*fliplr(t);
t = t(1:floor(max(length(corPRBS))/2));
trev = trev(length(trev) - floor(max(length(corPRBS))/2):end);
t = [trev t];
figure(2), stairs(t,corPRBS), xlabel('time'), ylabel('ACF');
title('xcorr');
iFrequencyTime = 1 / iSampleTime;
sp=spectrum.periodogram;
hpsd = psd(sp,aPRBS,'Fs',iFrequencyTime);
figure(3), psd(sp,aPRBS,'Fs',iFrequencyTime);
tChange = 0:iSampleTime:iFinalTime;
tChange = tChange(1:max(length(aPRBS)));
uPRBS = 0.8.*sin(2.*pi().*0.2.*tChange) + 0.2.*aPRBS;
signal.values = uPRBS*0.6 ;
% values to set the system's input (normalized , range [-1:+1])
signal.dt = iSampleTime.*ones(size(uPRBS)) ;
% duration of each value of the sequence (in seconds)
%
r = MonoRailTest(signal);
% call function
%
save 'results.mat';
load results.mat
%disp(r.ok);
figure(4), plot(r.time,r.measurements(:,1),'b');
hold on;
plot(r.time,r.inputs,'r');
xlabel('time'); legend('out','in');
hold off;
iresultfrequency = 1/(r.time(2)-r.time(1));
sp2=spectrum.periodogram;
hpsd2 = psd(sp2,r.measurements(:,1),'Fs',iresultfrequency);
hpsd3 = psd(sp2,r.inputs(:),'Fs',iresultfrequency);
hpsd2;
hpsd3;
ff = hpsd3.Frequencies;
Gomega = abs(10*log10(sqrt(hpsd2.Data./hpsd3.Data)));
Data_o = 10*log10(hpsd2.Data);
Data_i = 10*log10(hpsd3.Data);
figure(5);
semilogx(ff,Gomega,'r')
hold on;
semilogx(ff,Data_o,'b')
hold on;
semilogx(ff,Data_i,'g')
grid on;
legend('gain', 'out', 'in');
xlabel('frequency'); ylabel('LogPower');
end
Download