Image:Sigma delta.png

From Wikipedia, the free encyclopedia

Wikimedia Commons logo This is a file from the Wikimedia Commons. The description on its description page there is shown below.

[edit] Summary

Description

Main signals of a sigma-delta Pulse-Width Modulation (PWM)

Source

Own Work

Date

6/6/2006

Author

Cyril BUTTAY

Permission

as licenced

[edit] Licensing

I, the author 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".

العربية | Česky | Deutsch | English | Español | Français | Italiano | 日本語 | 한국어 | Nederlands | Polski | Português | Slovenčina | Svenska | עברית +/-

Some rights reserved
Creative Commons Attribution iconCreative Commons Share Alike icon
This file is licensed under the Creative Commons Attribution ShareAlike license versions 2.5, 2.0, and 1.0
You may select the license of your choice.


[edit] Details

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 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)

The following pages on the English Wikipedia link to this file (pages on other projects are not listed):