% Download the SAR-COVID sequence from GenBank

seq_obj = getgenbank ('NC_045512');
cov_seq = seq_obj.Sequence;

% Create a random sequence of the same length 

rand_seq = randseq (length(cov_seq));

% use sliding window plots for SAR-Cov and random

[xc, yc] = GCSlidingWindow (cov_seq, 1000, 100);
[xr, yr] = GCSlidingWindow (rand_seq, 1000, 100);

% plot gc fractions for the two sequences

hold on
plot (xc, yc, 'LineWidth', 2);
plot (xr, yr);
grid;
xtickangle(45);
xlabel('Sequence Length');
ylabel('GC Fraction');
ylim([0.2, 0.6])
legend('SARS-Covid Sequence', 'Random Sequence')