clear all; clc;

Fs = 77760000;  % Sample Frequency
f_DUT = 10000000; % frequency of the DUT
N = 2000; M =2000;

SPUR2 = zeros(N,M);
for n = 1: N
    for m = 1:M
        t = abs(n*Fs-m*f_DUT);
        SPUR(n,m) = t;
        if(t>10^6) SPUR2(n,m) = 0;
        else SPUR2(n,m) = t;
        end
    end
end

[row, col,v]= find(SPUR2);
RRR = [row, col, v];

% 'n*Fs   m*f_DUT   f_spurs'
R_Sort = sortrows(RRR,3)

freq = (1:1000000);
freq_Y = ones(1,1000000)*0.0000000001;
freq_Y(RRR(:,3)) = 1./(RRR(:,1).*RRR(:,2));

semilogx(freq,20*log10(freq_Y)-95);

ylim([-220 -40]);
xlim([10 1000000]);
grid on;
title('Sample Frequency vs Spurs');
