Code covered by the BSD License  

Highlights from
Delta Sigma Toolbox

image thumbnail

Delta Sigma Toolbox

by

 

14 Jan 2000 (Updated )

High-level design and simulation of delta-sigma modulators

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

dsdemo4fig()
function fig = dsdemo4fig()
% Window layout for the dsdemo4() function.

% This file has been hand-edited after using the "guide" command
% to create the initial layout and *fig.m file.
% Be wary of creating objects whose Units property is not "normalized"--
% these won't scale with the figure size.
% Other notes:
%  Frames can't be parents of buttons (i.e. to group them).
%  Unless 'Hold' is 'on', axes lose all properties (incl. tags) when plotted to.

%To Do:
% Make all buttons/fields functional.

switchYardFunction = 'dsdemo4';

h0 = figure('Units','normalized', ...
	'Color',[0.8 0.8 0.8], ...
	'HandleVisibility','callback', ...
	'IntegerHandle','off', ...
	'Name','Delta-Sigma Audio Demo', ...
	'NumberTitle','off', ...
	'Position',[0.009765625 0.2473958333333333 0.9658203125 0.6940104166666666], ...
	'Tag','Figni1');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'Position',[0.04 0.6697936210131332 0.2 0.3189493433395872], ...
	'Style','frame', ...
	'Tag','SourceFrame');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'ForegroundColor',[1 1 1], ...
	'HorizontalAlignment','right', ...
	'Interruptible','off', ...
	'Position',[0.07 0.9005628517823639 0.08678102926337034 0.025], ...
	'String','Duration (s)', ...
	'Style','text', ...
	'Tag','DurationLabel');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.1695257315842583 0.8911819887429644 0.05348133198789102 0.04127579737335835], ...
	'String','2', ...
	'Style','edit', ...
	'Tag','Duration', ...
	'UserData',2);
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'Position',[0.07 0.8030018761726079 0.08577194752774975 0.03], ...
	'String',['sine  ';'ramp  ';'speech'], ...
	'Style','popupmenu', ...
	'Tag','SourceType', ...
	'Value',1);
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'ForegroundColor',[1 1 1], ...
	'HorizontalAlignment','right', ...
	'Interruptible','off', ...
	'Position',[0.05 0.8555347091932458 0.11 0.025], ...
	'String','Sampling Rate (kHz)', ...
	'ToolTip','Linked to Decimation Factor', ...
	'Style','text', ...
	'Tag','FsText');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Interruptible','off', ...
	'Position',[0.1695257315842583 0.8442776735459663 0.05348133198789102 0.04127579737335835], ...
	'String','262', ...
	'Style','edit', ...
	'Tag','Fs', ...
	'UserData',262144);
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'ForegroundColor',[1 1 1], ...
	'HorizontalAlignment','right', ...
	'Interruptible','off', ...
	'Position',[0.07 0.7579737335834896 0.08678102926337034 0.025], ...
	'String','Frequency', ...
	'Style','text', ...
	'Tag','FreqLabel');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','dsdemo4(''setDuration'')', ...
	'Interruptible','off', ...
	'Position',[0.1695 0.7505 0.05348 0.04128], ...
	'String','500', ...
	'Style','edit', ...
	'Tag','SineFreq', ...
	'UserData',500);
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','dsdemo4(''setDuration'')', ...
	'Interruptible','off', ...
	'Position',[0.1695 0.7017 0.05348 0.04128], ...
	'String','0.5', ...
	'Style','edit', ...
	'Tag','SineAmp', ...
	'UserData',0.5);
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'ForegroundColor',[1 1 1], ...
	'HorizontalAlignment','right', ...
	'Interruptible','off', ...
	'Position',[0.07 0.7110694183864915 0.08678102926337034 0.025], ...
	'String','Amplitude', ...
	'Style','text', ...
	'Tag','AmpLabel');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'Position',[0.4359233097880928 0.7523452157598499 0.1291624621594349 0.1932457786116323], ...
	'Style','frame', ...
	'Tag','ModulatorFrame', ...
	'UserData', [1 1 -1; 1 0 0]);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'FontSize',18, ...
	'ForegroundColor',[1 1 1], ...
	'Interruptible','off', ...
	'Position', [0.4470 0.8800 0.1070 0.0525], ...
	'String','Modulator', ...
	'Style','text', ...
	'Tag','StaticText4');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'ButtonDownFcn','mod1', ...
	'ForegroundColor',[1 1 1], ...
	'Position',[0.4732052578361983 0.8330206378986866 0.05460060667340749 0.0450281425891182], ...
	'String','mod1', ...
	'Style','radiobutton', ...
	'Callback','dsdemo4(''mod1'')', ...
	'Tag','mod1', ...
	'Value',1);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'Position',[0.4732052578361983 0.78799249530957 0.05460060667340749 0.0450281425891182], ...
	'String','mod2', ...
	'Style','radiobutton', ...
	'Callback','dsdemo4(''mod2'')', ...
	'Tag','mod2');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'Position',[0.7598    0.7280    0.1806    0.2345], ...
	'Style','frame', ...
	'Tag','DecFrame');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'FontSize',18, ...
	'ForegroundColor',[1 1 1], ...
	'Interruptible','off', ...
	'Position',[0.7739656912209889 0.8893058161350844 0.1513622603430878 0.0525328330206379], ...
	'String','Sinc Decimator', ...
	'Style','text', ...
	'Tag','DecimatorFrameTitle');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'ForegroundColor',[1 1 1], ...
	'HorizontalAlignment','right', ...
	'Interruptible','off', ...
	'Position',[0.7679112008072654 0.8180112570356473 0.09485368314833502 0.0375234521575985], ...
	'String','Order', ...
	'Style','text', ...
	'Tag','SincOrderLabel');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','dsdemo4(''setDuration'')', ...
	'Interruptible','off', ...
	'Position',[0.8678102926337034 0.8236397748592871 0.05348133198789102 0.04127579737335835], ...
	'String','2', ...
	'Style','edit', ...
	'Tag','SincOrder', ...
	'UserData',2);
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'ForegroundColor',[1 1 1], ...
	'HorizontalAlignment','right', ...
	'Interruptible','off', ...
	'Position',[0.7679112008072654 0.7636022514071295 0.09485368314833502 0.0375234521575985], ...
	'String','Decimation Factor', ...
	'Style','text', ...
	'Tag','DecFactLabel', ...
	'ToolTip','Linked to Sampling Rate');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Interruptible','off', ...
	'Position',[0.8678102926337034 0.7692307692307693 0.05348133198789102 0.04127579737335835], ...
	'String','32', ...
	'Style','edit', ...
	'Tag','DecFact', ...
	'UserData',32);
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[0.5 0.5 0.5], ...
	'FontSize',18, ...
	'ForegroundColor',[1 1 1], ...
	'Interruptible','off', ...
	'Position',[0.04 0.94 0.2 0.04], ...
	'String','Source', ...
	'Style','text', ...
	'Tag','StaticText4');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'FontSize',18, ...
	'Position',[0.942366026289181 0.6641651031894934 0.04448938321536906 0.05440900562851782], ...
	'String','Go', ...
	'Tag','Go');
set(h1,'Callback',[switchYardFunction '(''' get(h1,'Tag') ''')']);
h1 = axes('Parent',h0, ...
	'Box','on', ...
	'CameraUpVector',[0 1 0], ...
	'CameraUpVectorMode','manual', ...
	'Color',[1 1 1], ...
	'Position',[0.02421796165489404 0.3527204502814259 0.2653884964682139 0.2945590994371482], ...
	'Tag','u(t)', ...
	'XColor',[0 0 0], ...
	'XTickMode','manual', ...
	'YColor',[0 0 0], ...
	'YGrid','on', ...
	'YLim',[-1.2  1.2], ...
	'YTick',[-1 -0.5 0 0.5 1], ...
	'YTickLabel',{'-1', '', '', '', '1', }, ...
	'YTickMode','manual', ...
	'ZColor',[0 0 0]);
set(h1,'ButtonDownFcn',[switchYardFunction '(''PlayU'')']);
h1 = axes('Parent',h0, ...
	'Box','on', ...
	'CameraUpVector',[0 1 0], ...
	'CameraUpVectorMode','manual', ...
	'Color',[1 1 1], ...
	'Position',[0.3733602421796166 0.3527204502814259 0.2653884964682139 0.2945590994371482], ...
	'Tag','v(t)', ...
	'XColor',[0 0 0], ...
	'XTickMode','manual', ...
	'YColor',[0 0 0], ...
	'YGrid','on', ...
	'YLim',[-1.2  1.2], ...
	'YTick',[-1 -0.5 0 0.5 1], ...
	'YTickLabel',{'-1', '', '', '', '1', }, ...
	'YTickMode','manual', ...
	'ZColor',[0 0 0]);
h1 = axes('Parent',h0, ...
	'Box','on', ...
	'CameraUpVector',[0 1 0], ...
	'CameraUpVectorMode','manual', ...
	'Color',[1 1 1], ...
	'Position',[0.7235116044399597 0.3527204502814259 0.2653884964682139 0.2945590994371482], ...
	'Tag','w(t)', ...
	'XColor',[0 0 0], ...
	'XTickMode','manual', ...
	'YColor',[0 0 0], ...
	'YGrid','on', ...
	'YLim',[-1.2  1.2], ...
	'YTick',[-1 -0.5 0 0.5 1], ...
	'YTickLabel',{'-1', '', '', '', '1', }, ...
	'YTickMode','manual', ...
	'ZColor',[0 0 0]);
set(h1,'ButtonDownFcn',[switchYardFunction '(''PlayW'')']);
h1 = axes('Parent',h0, ...
	'Box','on', ...
	'CameraUpVector',[0 1 0], ...
	'CameraUpVectorMode','manual', ...
	'Color',[1 1 1], ...
	'Position',[0.02421796165489404 0.0225140712945591 0.2653884964682139 0.2945590994371482], ...
	'Tag','U(f)', ...
	'XColor',[0 0 0], ...
	'XLim',[10 4096], ...
	'XScale','log', ...
	'XGrid','on', ...
	'XTick',[ 10  20 30 40 50 60 70 80 90 ...
	         100 200 300 400 500 600 700 800 900 ...
			 1000 2000 3000 4000], ...
	'XTickLabel',{'10', '', '', '', '', '', '', '', '', ...
	             '100', '', '', '', '', '', '', '', '', ...
				 '1kHz', '', '', '' }, ...
	'YTickMode','manual', ...
	'YColor',[0 0 0], ...
	'YGrid','on', ...
	'YLim',[-100 0], ...
	'YTick',[-100 -80 -60 -40 -20 0], ...
	'YTickMode','manual', ...
	'ZColor',[0 0 0]);
h1 = axes('Parent',h0, ...
	'Box','on', ...
	'CameraUpVector',[0 1 0], ...
	'CameraUpVectorMode','manual', ...
	'Color',[1 1 1], ...
	'Position',[0.3733602421796166 0.0225140712945591 0.2653884964682139 0.2945590994371482], ...
	'Tag','V(f)', ...
	'XColor',[0 0 0], ...
	'XGrid','on', ...
	'XScale','log', ...
	'XTickMode','auto', ...
	'YColor',[0 0 0], ...
	'YGrid','on', ...
	'YLim',[-100 0], ...
	'YTick',[-100 -80 -60 -40 -20 0], ...
	'YTickMode','manual', ...
	'ZColor',[0 0 0]);
h1 = axes('Parent',h0, ...
	'Box','on', ...
	'CameraUpVector',[0 1 0], ...
	'CameraUpVectorMode','manual', ...
	'Color',[1 1 1], ...
	'Position',[0.7235116044399597 0.0225140712945591 0.2653884964682139 0.2945590994371482], ...
	'Tag','W(f)', ...
	'XColor',[0 0 0], ...
	'XLim',[10 4096], ...
	'XScale','log', ...
	'XGrid','on', ...
	'XTick',[ 10  20 30 40 50 60 70 80 90 ...
	         100 200 300 400 500 600 700 800 900 ...
			 1000 2000 3000 4000], ...
	'XTickLabel',{'10', '', '', '', '', '', '', '', '', ...
	             '100', '', '', '', '', '', '', '', '', ...
				 '1kHz', '', '', '' }, ...
	'YTickMode','manual', ...
	'YColor',[0 0 0], ...
	'YGrid','on', ...
	'YLim',[-100 0], ...
	'YTick',[-100 -80 -60 -40 -20 0], ...
	'YTickMode','manual', ...
	'ZColor',[0 0 0]);
set(h1,'ButtonDownFcn',[switchYardFunction '(''PlayE'')']);
if nargout > 0, fig = h0; end

Contact us