File:Dds time-8 16.svg

Summary

Description
English: Output signals of a Direct Digital Synthesizer, nice step
Date
Source Own work
Author Fcorthay

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:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported 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.
Category:CC-BY-SA-3.0#Dds%20time-8%2016.svg
Category:Self-published work Category:Digital signal processing
Category:CC-BY-SA-3.0 Category:Digital signal processing Category:Self-published work