Lab03 (R)
Lab03 (R)
Islamabad
Remarks: ……………………………………………
1. Objective
After completing this lab, students will have learned how to:
2. Introduction
Both in signal and systems analysis, the concept of autocorrelation and cross correlation
plays an important role
2.1 Autocorrelation
The autocorrelation function of a random signal describes the general dependence of the values
of the samples at one time on the values of the samples at another time. Consider a random
process x(t) (i.e. continuous-time), its autocorrelation function is written as:
For sampled signal (i.e. sampled signal), the autocorrelation is defined as either biased or
unbiased defined as follows:
3. MATLAB Simulation
Matlab provides a function called xcorr.m which may be used to implement both auto
and cross correlation function. Its use is indicated in the following examples:
3.1 Autocorrelation of a sinewave
Plot the autocorrelation sequence of a sinewave with frequency 1 Hz, sampling
frequency of 200 Hz.
The Matlab program is listed below:
N=1024; % Number of samples
xlabel('Time, [s]');
ylabel('Amplitude');
grid;
xlable('lags');
ylabel('Autocorrelation');
subplot(3,1,1);
plot(x);
title('Pure Sinewave');
grid;
subplot(3,1,2);
plot(y);
grid;
subplot(3,1,3);
plot(Rxy)
;
title('Cross correlation Rxy');
grid;
In this task you are required to generate a message signal which is actually a Sinusoidal signal of
Fundamental Frequency defined by the user, sampled at 10 x (Fundamental Freq) Samples per
Sec.
1) Plot signal
2) Write a code that computes the cross correlation between the transmitted and received signal.
Figure 2
3. Generate N=256 samples of Gaussian random signal and call this w(n).
4. Generate the simulated received signal by adding the transmitted signal x(n) and the
noise signal w(n), i.e.
In this task you are required to Generate N=256 samples of a sinusoidal signal of amplitude 1
volts, frequency, f1=1Hz. Use a sampling frequency, Fs =200Hz, and call this signal the
transmitted signal.
4. From this plot estimate the delay time (Time where it peaks) and compare to the
theoretical value of 2.5s.
7. Repeat the experiment for the noise variance of 0, 0.1,0.4, and 0.8.
8. Estimate the error in each case.
# Qualities & 0 < Poor <= 12< Satisfactory 21 < Good <= 27 < Excellent
Criteria 12 <= 21 27 <= 30
ER1 Task No Tasks were Some tasks were Few tasks were All tasks
Completion completed/ completed. Could left to be completed in
minimal effort not justify the completed. due time. All
shown reasons for Provided goals achieved.
uncompleted tasks acceptable
and goals. justification for
the uncompleted
tasks and goals.
z# Qualities & 0 < Poor <= 8 8 < Satisfactory 14 < Good <= 18 < Excellent
Criteria <= 14 18 <= 20
ER7 Code No indentation Computationally Working code Good structure,
indentation, of code, no complex routine and good optimized code
optimization optimization with improper indentation or and good
and and no indentation and structure, but variable names
descriptive descriptive variable names not optimized and comments
variable variable names/ resulting in
name minimal effort unnecessary
shown computations
# Qualities & 0 < Poor <= 8 8 < Satisfactory 14 < Good <= 18 < Excellent
Criteria <= 14 18 <= 20
ER8 Comparison No comparison Irrelevant Fair comparisons Comprehensive
and or evaluation comparisons or with some good comparisons
Evaluation concluded/ comparisons evaluations conducted with
minimal effort without evaluations logical
shown evaluations
# Qualities & 0 < Poor <= 12 < 21< Good 27< Excellent
Criteria 12 Satisfactory <= <=27 <= 30
21
ER9 Results and Unable to Inaccurate plots Correct plots Good