Summary
Source code
This graphics has been realized with the help of the following Octave script:
#-------------------------------------------------------------------------------
# Specifications
#
bitNb = 8;
clockFrequency = 100E6;
outputFrequency = clockFrequency / (2^(bitNb-4));
outputFrequency = 7/8 * outputFrequency;
fftMin = -100;
printFigures = 1;
pointNb = 2^bitNb;
#===============================================================================
# DDS time signals
#
step = round(2^bitNb * (outputFrequency/clockFrequency));
sawtooth = zeros(1, pointNb);
for index = 2:length(sawtooth)
sawtooth(index) = rem(sawtooth(index-1) + step, 2^bitNb);
endfor
msb = sawtooth >= 2^(bitNb-1);
sine = sin(sawtooth*(2*pi)/2^bitNb);
figure(1);
time = [1:length(sawtooth)] / clockFrequency;
plot(time, sawtooth, 'g');
hold on;
plot(time, msb*2^(bitNb-1), 'r');
plot(time, sine*2^(bitNb-2)+2^(bitNb-2), 'b');
hold off;
xlabel('time');
ylabel('DDS outputs');
title(['Direct Digital Synthesizer, ', ...
sprintf('%d', bitNb), ' bits, step = ', ...
sprintf('%d', step)]);
grid;
if (printFigures != 0)
print -dsvg dds_time.svg
endif
#-------------------------------------------------------------------------------
# Fourier transform
#
msbTransform = 20*log10(abs(fft(2*(msb-0.5)))/length(msb));
msbTransform(msbTransform < fftMin) = fftMin;
sineTransform = 20*log10(abs(fft(sine))/length(msb));
sineTransform(sineTransform < fftMin) = fftMin;
frequency = linspace(0, clockFrequency, pointNb);
figure(2);
plot(frequency, msbTransform, 'r');
hold on;
plot(frequency, sineTransform, 'b');
hold off;
xlabel('frequency');
ylabel('DDS outputs FFT');
title(['Direct Digital Synthesizer, ', ...
sprintf('%d', bitNb), ' bits, step = ', ...
sprintf('%d', step)]);
grid;
if (printFigures != 0)
print -dsvg dds_frequency.svg
endif
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
You are free:
to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original. https://creativecommons.org/licenses/by-sa/3.0 CC BY-SA 3.0 Creative Commons Attribution-Share Alike 3.0 true true English Add a one-line explanation of what this file represents