File:Sigma delta.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(1,500 × 1,050 pixels, file size: 93 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description Main signals of a sigma-delta Pulse-Width Modulation (PWM)
Date
Source Own work
Author Cyril BUTTAY
Permission
(Reusing this file)
as licenced

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation 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.
This licensing tag was added to this file as part of the GFDL licensing update.
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 2.5 Generic, 2.0 Generic and 1.0 Generic 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.
You may select the license of your choice.

Details[edit]

This graph represents the main signals of a sigma-delta PWM. The top green waveform is the reference signal, on which the output signal (PWM, in the middle plot) is substracted to form the error signal (blue, in top plot). This error is integrated (bottom plot), and when the integral of the error exceeds the limits (red lines), the output changes state.

 
This plot was created with Gnuplot.

This figure was made using the following python code (requires gnuplot 4.0 and scipy):

#!/usr/bin/python

#this file generates data and the gnuplot file used for the sigma
# delta pwm plot. Needs python, scipy and gnuplot (4.0 used)
from scipy import *

freq= 0.05 	# frequency of the reference signal
step=1e-3  	# calculation time step
hysteresis=0.15	# hysteresis of the sigma-delta pwm

pwm=[1]		# This vector is the pwm signal
grid=["0"]	# this vector contains the x-values at which the pwm signal
		# changes state
error=[0]
integral=[0]
file = open("sigma_delta.dat","w") # the data file

for i in range(int(1/(freq*step))):
    reference=sin(i*step*freq*2*pi)
    error=reference-pwm[i]
    integral.append(integral[i]+step*error)
    if integral[i+1]>hysteresis:
        pwm.append(1)
        grid.append("%s"%(i*step))
    elif integral[i+1]<-hysteresis:
        pwm.append(-1)
        grid.append("%s"%(i*step))
    else:
        pwm.append(pwm[i])

    file.write('%s\t%s\t%s\t%s\t%s\n'%(i*step,reference,pwm[i],
                                           error,integral[i]))
file.close()				# end of data generation

xtics=',"" '.join(grid)			# creates a string used for the x-tics
file = open("sigma_delta.plt","w")	# generates the gnuplot file
file.write("""
# This file is used to generate a plot that explains the 
# principle of the sigma-delta pwm

# graph configuration
set terminal postscript eps enhanced "Times-Roman" 24 color solid
set encoding iso_8859_15
unset title
set line style 1 lt 3 lw 3 pt 0 ps 0
set line style 2 lt 2 lw 3 pt 0 ps 0
set line style 3 lt 8 lw 2 pt 0 ps 0
set line style 4 lt 4 lw 3 pt 0 ps 0
set border 15 lt 7 lw 4

set grid xtics ytics
set xlabel ""
set format x ""
set bmargin 0
set tmargin 0
 
set ytics 1
set xtics (%s)

set output "sigma_delta.eps"
set multiplot
 	set ylabel "Ref. and Error"
	set origin 0,0.695
	set size 1,0.3
	plot [0:19][-2.2:2.2] 'sigma_delta.dat' using 1:2 ls 2 title '' w l,\
	'' using 1:4 ls 1 title '' w l

	set ylabel "PWM"
	set origin 0,0.395
	plot [0:19][-1.2:1.2]'sigma_delta.dat' using 1:3 ls 4 title '' w l

        set arrow 1 from graph 0,first %s to graph 1, first %s nohead
        set arrow 2 from graph 0,first %s to graph 1, first %s nohead
	set ylabel "Integration"
        set xlabel "Time"
	set origin 0,0.095
	plot [0:19][-0.25:0.25] 'sigma_delta.dat' using 1:5 ls 1 title '' w l     
unset multiplot	""" %( xtics, hysteresis, hysteresis, -hysteresis, -hysteresis))
file.close() 				# end of the gnuplot file.

#%set ytics ("0" 0, "-1" -1, "1" 1)

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current20:41, 6 June 2006Thumbnail for version as of 20:41, 6 June 20061,500 × 1,050 (93 KB)CyrilB~commonswiki (talk | contribs){{Information |Description=Main signals of a sigma-delta Pulse-Width Modulation (PWM) |Source=Own Work |Date=6/6/2006 |Author=Cyril BUTTAY |Permission=as licenced |other_versions= }}