function compute_autocorr()
    % Define the input sequence
    x = [1, 2, 3, 4];

    % Determine the auto-correlation and corresponding lags
    [Rxx, lags] = xcorr(x);

    % Display the results in the command window
    disp('Input Sequence x(n):');
    disp(x);

    disp('Autocorrelation Sequence Rxx:');
    disp(Rxx);

    disp('Corresponding Lags:');
    disp(lags);
    
    % Wait for user input so compiled terminal window doesn't instantly close
    input('Press Enter to exit...', 's');
end

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: