Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Included for this project is the file clocktime.mat, a MATLAB data file containi

ID: 2085468 • Letter: I

Question

Included for this project is the file clocktime.mat, a MATLAB data file containing the clock readings from the reference clock ("tref") and 7 embedded node clocks ("t1" through "t7") with different drifts. Furthermore, we include rho_solution.mat, which contains the calculated drift rates for the 7 clocks.

Using this data perform the following tasks:

Assuming a convergence function equal to 0, and given a precision requirement equal to 0.5 seconds and the drift rate results from Module 3 provided in in rho_solution.mat, compute the resynchronization interval.

Write a Matlab function that implements the Fault-Tolerant Averaging (FTA) method in Matlab.

Write the Matlab code to perform the FTA method on the data from clocktime.mat (only "t1" though "t7"') every resynchronization interval.

Generate a graph similar to the one on slide 29 of the Module 4 notes plotting reference clock versus local clock or local clock versus reference clock after synchronization.

Provide a write-up (in Word or other comparable text editor) of your findings. Include all the plots in your text with correct crossreferences to them in the text. Also, include a short discussion for each of the plots and tasks and make sure to include references to any equations or documents that you used.

*This is a screenshot of clocktime.mat, all the contents are the same throughout all cells* Variables tref 1x10000 double 6859 6860 6861 6862 6863 6864 6365 6866 6867 6368 14 7.4347e+04 7.4347e+04 7.4347e+04 7.437e04 7.4347e+04 7.4347e 7.4347e +04 7.4347e+04 7.4347e+04 7.4347e+04 1x10000 double tl-t7 has al the same numbers

Explanation / Answer

Matlab function that implements the Fault-Tolerant Averaging (FTA) method

The averaging_filter.m function acts as an averaging filter on the input signal; it takes an input vector of values and computes an average for each value in the vector. The output vector is the same size and shape as the input vector.

% y = averaging_filter(x)
% Take an input vector signal 'x' and produce an output vector signal 'y' with
% same type and shape as 'x' but filtered.
function y = averaging_filter(x) %#codegen
% Use a persistent variable 'buffer' that represents a sliding window of
% 16 samples at a time.
persistent buffer;
if isempty(buffer)
    buffer = zeros(16,1);
end
y = zeros(size(x), class(x));
for i = 1:numel(x)
    % Scroll the buffer
    buffer(2:end) = buffer(1:end-1);
    % Add a new sample value to the buffer
    buffer(1) = x(i);
    % Compute the current average value of the window and
    % write result
    y(i) = sum(buffer)/numel(buffer);
end

Inspect the C Code for the 'averaging_filter.c' Function