www.gusucode.com > 声音的处理有:LPC,FFT,共振峰,频谱源码程序 > siganlandsystemusingMatlab/SSUM/sample/samplexpogui.m
function varargout = samplexpogui(varargin) % SAMPLEXPOGUI.m-file for samplexpogui.fig % SAMPLEXPOGUI, by itself, creates a new SAMPLEXPOGUI or raises the existing % singleton*. % % H = SAMPLEXPOGUI returns the handle to a new SAMPLEXPOGUI or the handle to % the existing singleton*. % % SAMPLEXPOGUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in SAMPLEXPOGUI.M with the given input arguments. % % SAMPLEXPOGUI('Property','Value',...) creates a new SAMPLEXPOGUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before samplexpogui_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to samplexpogui_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Last Modified by GUIDE v2.5 31-Mar-2004 13:24:40 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @samplexpogui_OpeningFcn, ... 'gui_OutputFcn', @samplexpogui_OutputFcn, ... 'gui_LayoutFcn', @samplexpogui_LayoutFcn, ... 'gui_Callback', []); if nargin & isstr(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before sinesumgui2 is made visible. function samplexpogui_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; guidata(hObject, handles); set(gcf,'UserData',handles); samplexpofn; % --- Outputs from this function are returned to the command line. function varargout = samplexpogui_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; function freq1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function amp1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function phase1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % Executes on textbox entry function freq1_Callback(hObject, eventdata, handles) freq1 = str2num(get(hObject,'String')); if freq1 < 20 freq1 = 20; elseif freq1 > 1000 freq1 = 1000; end set(handles.freq1,'String',num2str(freq1)); set(handles.freq1slider,'Value',freq1); samplexpofn 'update'; function amp1_Callback(hObject, eventdata, handles) amp1 = str2num(get(hObject,'String')); if amp1 < 0 amp1 = 0; elseif amp1 > 1 amp1 = 1; end set(handles.amp1,'String',num2str(amp1)); set(handles.amp1slider,'Value',amp1); samplexpofn 'update'; function phase1_Callback(hObject, eventdata, handles) phase1 = str2num(get(hObject,'String')); if phase1 < -180 while phase1 < -180 phase1 = phase1 + 360; end elseif phase1 > 180 while phase1 > 180 phase1 = phase1 - 360; end end set(handles.phase1,'String',num2str(phase1)); set(handles.phase1slider,'Value',phase1); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function freq1slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function freq1slider_Callback(hObject, eventdata, handles) freq1 = num2str(get(hObject,'Value')); set(handles.freq1,'String',freq1); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function amp1slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function amp1slider_Callback(hObject, eventdata, handles) amp1 = num2str(get(hObject,'Value')); set(handles.amp1,'String',amp1); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function phase1slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function phase1slider_Callback(hObject, eventdata, handles) phase1 = num2str(get(hObject,'Value')); set(handles.phase1,'String',phase1); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function offset_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function offset_Callback(hObject, eventdata, handles) offset = str2num(get(hObject,'String')); if offset < 0 offset = 0; elseif offset > 1 offset = 1; end set(handles.offset,'String',num2str(offset)); set(handles.offsetslider,'Value',offset); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function offsetslider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function offsetslider_Callback(hObject, eventdata, handles) offset = num2str(get(hObject,'Value')); set(handles.offset,'String',offset); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function Fs_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function Fs_Callback(hObject, eventdata, handles) Fs = str2num(get(hObject,'String')); if (Fs > 1000) Fs = 1000; end if (Fs < 0) Fs = 0; end set(handles.Fsslider,'Value',log2(Fs)); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function Fsslider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function Fsslider_Callback(hObject, eventdata, handles) Fs = num2str(floor(2^get(hObject,'Value'))); if (Fs > 1000) Fs = 1000; end if (Fs < 0) Fs = 0; end set(handles.Fs,'String',Fs); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function periods_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function periods_Callback(hObject, eventdata, handles) periods = str2num(get(hObject,'String')); if periods < 1 periods = 1; elseif periods > 10 periods = 10; end set(handles.periods,'String',num2str(periods)); set(handles.periodslider,'Value',periods); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function periodslider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function periodslider_Callback(hObject, eventdata, handles) periods = num2str(get(hObject,'Value')); set(handles.periods,'String',periods); samplexpofn 'update'; % --- Executes on button press in gridbox. function gridbox_Callback(hObject, eventdata, handles) samplexpofn 'update'; % --- Executes on button press in interpbox. function interpbox_Callback(hObject, eventdata, handles) samplexpofn 'update'; % --- Executes on button press in samplebox. function samplebox_Callback(hObject, eventdata, handles) samplexpofn 'update'; % --- Executes when user attempts to close samplexpogui_fig. function samplexpogui_fig_CloseRequestFcn(hObject, eventdata, handles) delete(hObject); % --- Executes during object creation, after setting all properties. function nbits_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function nbits_Callback(hObject, eventdata, handles) nbits = floor(str2num(get(hObject,'String'))); if nbits < 1 nbits = 1; elseif nbits > 16 nbits = 16; end set(handles.nbits,'String',num2str(nbits)); set(handles.nbitsslider,'Value',nbits); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function nbitsslider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function nbitsslider_Callback(hObject, eventdata, handles) nbits = num2str(floor(get(hObject,'Value'))); set(handles.nbits,'String',nbits); samplexpofn 'update'; % --- Executes during object creation, after setting all properties. function wave_CreateFcn(hObject, eventdata, handles) % hObject handle to wave (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in wave. function wave_Callback(hObject, eventdata, handles) samplexpofn 'update'; % -------------------------------------------------------------------- function help_Callback(hObject, eventdata, handles) % hObject handle to help (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) samplexpofn 'help'; % --- Creates and returns a handle to the GUI figure. function h1 = samplexpogui_LayoutFcn(policy) % policy - create a new figure or use a singleton. 'new' or 'reuse'. persistent hsingleton; if strcmpi(policy, 'reuse') & ishandle(hsingleton) h1 = hsingleton; return; end h1 = figure(... 'Units','characters',... 'Color',[0.701960784313725 0.701960784313725 0.701960784313725],... 'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],... 'IntegerHandle','off',... 'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),... 'KeyPressFcn','update_Callback(hObject, eventdata, handles)',... 'MenuBar','none',... 'Name','samplexpo',... 'NumberTitle','off',... 'PaperPosition',get(0,'defaultfigurePaperPosition'),... 'Position',[128.6 0.307692307692299 115.2 54],... 'Renderer',get(0,'defaultfigureRenderer'),... 'RendererMode','manual',... 'Resize','off',... 'HandleVisibility','callback',... 'Tag','samplexpo_fig',... 'UserData',[]); setappdata(h1, 'GUIDEOptions',struct(... 'active_h', [], ... 'taginfo', struct(... 'figure', 2, ... 'axes', 6, ... 'pushbutton', 5, ... 'popupmenu', 4, ... 'edit', 15, ... 'text', 18, ... 'slider', 14, ... 'frame', 4, ... 'togglebutton', 2, ... 'checkbox', 7), ... 'override', 1, ... 'release', 13, ... 'resize', 'none', ... 'accessibility', 'callback', ... 'mfile', 1, ... 'callbacks', 1, ... 'singleton', 1, ... 'syscolorfig', 1, ... 'lastSavedFile', '/Users/bobsturm/gibson/SSUM.PC/sample/samplexpo.m', ... 'blocking', 0)); h2 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'ListboxTop',0,... 'Position',[57.4 6.38461538461538 46.6 10.1538461538462],... 'String',{ '' },... 'Style','frame',... 'Tag','frame3',... 'UserData',[]); h3 = axes(... 'Parent',h1,... 'Units','characters',... 'ALim',get(0,'defaultaxesALim'),... 'ALimMode','manual',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode','manual',... 'CameraTarget',[0.5 0.5 0.5],... 'CameraTargetMode','manual',... 'CameraUpVector',[0 1 0],... 'CameraUpVectorMode','manual',... 'CameraViewAngle',6.60861036031192,... 'CameraViewAngleMode','manual',... 'CLim',get(0,'defaultaxesCLim'),... 'CLimMode','manual',... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'DataAspectRatio',get(0,'defaultaxesDataAspectRatio'),... 'DataAspectRatioMode','manual',... 'PlotBoxAspectRatio',get(0,'defaultaxesPlotBoxAspectRatio'),... 'PlotBoxAspectRatioMode','manual',... 'Position',[10.2 36.3076923076923 103 16.0769230769231],... 'TickDir',get(0,'defaultaxesTickDir'),... 'TickDirMode','manual',... 'XColor',get(0,'defaultaxesXColor'),... 'XLim',get(0,'defaultaxesXLim'),... 'XLimMode','manual',... 'XTick',[0 0.2 0.4 0.6 0.8 1],... 'XTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'XTickLabelMode','manual',... 'XTickMode','manual',... 'YColor',get(0,'defaultaxesYColor'),... 'YLim',get(0,'defaultaxesYLim'),... 'YLimMode','manual',... 'YTick',[0 0.2 0.4 0.6 0.8 1],... 'YTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'YTickLabelMode','manual',... 'YTickMode','manual',... 'ZColor',get(0,'defaultaxesZColor'),... 'ZLim',get(0,'defaultaxesZLim'),... 'ZLimMode','manual',... 'ZTick',[0 0.5 1],... 'ZTickLabel','',... 'ZTickLabelMode','manual',... 'ZTickMode','manual',... 'Tag','sampleplot',... 'UserData',[]); h4 = get(h3,'title'); set(h4,... 'Parent',h3,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.496598639455782 1.04421768707483 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h5 = get(h3,'xlabel'); set(h5,... 'Parent',h3,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.496598639455782 -0.153061224489796 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h6 = get(h3,'ylabel'); set(h6,... 'Parent',h3,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.163265306122449 0.493197278911564 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h7 = get(h3,'zlabel'); set(h7,... 'Parent',h3,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-1.48979591836735 2.14625850340136 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h8 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'ListboxTop',0,... 'Position',[1.4 4.07692307692308 53.2 12.4615384615385],... 'String',{ '' },... 'Style','frame',... 'Tag','frame1',... 'UserData',[]); h9 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''freq1_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41 14.3076923076923 12 1.46153846153846],... 'String','100',... 'Style','edit',... 'Value',[],... 'ButtonDownFcn','samplexpogui(''freq1_ButtonDownFcn'',gcbo,[],guidata(gcbo))',... 'CreateFcn','samplexpogui(''freq1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','freq1'); h10 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''amp1_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41 11.3846153846154 12 1.46153846153846],... 'String','0.5',... 'Style','edit',... 'CreateFcn','samplexpogui(''amp1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','amp1'); h11 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''phase1_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41 8.61538461538462 12 1.46153846153846],... 'String','0.0',... 'Style','edit',... 'CreateFcn','samplexpogui(''phase1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','phase1'); h12 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[3.4 14.1538461538462 16.2 1.30769230769231],... 'String','Frequency (Hz)',... 'Style','text',... 'Tag','text1',... 'UserData',[]); h13 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[3.4 11.1538461538462 11.4 1.46153846153846],... 'String','Amplitude',... 'Style','text',... 'Tag','text3',... 'UserData',[]); h14 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[3.4 8.38461538461538 13.4 1.23076923076923],... 'String','Phase (deg)',... 'Style','text',... 'Tag','text5',... 'UserData',[]); h15 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','samplexpogui(''freq1slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',1000,... 'Min',20,... 'Position',[3.2 13.1538461538462 50 1],... 'String','',... 'Style','slider',... 'Value',100,... 'CreateFcn','samplexpogui(''freq1slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','freq1slider'); h16 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','samplexpogui(''amp1slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[3.2 10.3846153846154 50 1],... 'String','0.5',... 'Style','slider',... 'Value',0.5,... 'CreateFcn','samplexpogui(''amp1slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','amp1slider'); h17 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','samplexpogui(''phase1slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',180,... 'Min',-180,... 'Position',[3.2 7.30769230769231 50 1],... 'String','0.0',... 'Style','slider',... 'CreateFcn','samplexpogui(''phase1slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','phase1slider'); h18 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''offset_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41 5.69230769230769 12 1.46153846153846],... 'String','0.0',... 'Style','edit',... 'CreateFcn','samplexpogui(''offset_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','offset'); h19 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[3.4 5.46153846153846 8 1.30769230769231],... 'String','Offset',... 'Style','text',... 'Tag','text10',... 'UserData',[]); h20 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','samplexpogui(''offsetslider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[3.2 4.46153846153846 50 1],... 'String','0.0',... 'Style','slider',... 'CreateFcn','samplexpogui(''offsetslider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','offsetslider'); h21 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[59 13.7692307692308 18 1.76923076923077],... 'String','Sampling Rate',... 'Style','text',... 'Tag','text11',... 'UserData',[]); h22 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''Fs_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[91 14.4615384615385 12 1.38461538461538],... 'String','1000',... 'Style','edit',... 'Value',[],... 'CreateFcn','samplexpogui(''Fs_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','Fs'); h23 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','samplexpogui(''Fsslider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',9.9658,... 'Min',4.322,... 'Position',[59 13.3846153846154 44 0.846153846153846],... 'String','9.9658',... 'Style','slider',... 'Value',9.9658,... 'CreateFcn','samplexpogui(''Fsslider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','Fsslider'); h24 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[59 7.92307692307692 18 1.76923076923077],... 'String','Periods to plot',... 'Style','text',... 'Tag','rre',... 'UserData',[]); h25 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''periods_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[91 8.76923076923077 12 1.38461538461538],... 'String','1',... 'Style','edit',... 'Value',1,... 'CreateFcn','samplexpogui(''periods_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','periods'); h26 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','samplexpogui(''periodslider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',10,... 'Min',1,... 'Position',[59 7.46153846153846 44 0.846153846153846],... 'String','',... 'Style','slider',... 'Value',1,... 'CreateFcn','samplexpogui(''periodslider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','periodslider'); h27 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',18,... 'FontWeight','bold',... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[1.4 1.76923076923077 49.4 2.15384615384615],... 'String','Sampling Explorer',... 'Style','text',... 'Tag','text13'); h28 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''gridbox_Callback'',gcbo,[],guidata(gcbo))',... 'CData',[],... 'ListboxTop',0,... 'Position',[57.4 4 11.4 1.84615384615385],... 'String','Grid',... 'Style','checkbox',... 'Value',1,... 'Tag','gridbox',... 'UserData',[]); h29 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''interpbox_Callback'',gcbo,[],guidata(gcbo))',... 'CData',[],... 'ListboxTop',0,... 'Position',[84.2 4 17.2 1.84615384615385],... 'String','Interpolation',... 'Style','checkbox',... 'Tag','interpbox',... 'UserData',[]); h30 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''samplebox_Callback'',gcbo,[],guidata(gcbo))',... 'CData',[],... 'ListboxTop',0,... 'Position',[68.8 4 13.6 1.84615384615385],... 'String','Samples',... 'Style','checkbox',... 'Value',1,... 'Tag','samplebox',... 'UserData',[]); h31 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[1.4 0.153846153846154 49.2 1.53846153846154],... 'String','by Bob L. Sturm and Dr. Jerry Gibson',... 'Style','text',... 'Tag','text15'); h32 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[59 10.9230769230769 18 1.76923076923077],... 'String','Number of Bits',... 'Style','text',... 'Tag','text16',... 'UserData',[]); h33 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''nbits_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[91 11.5384615384615 12 1.38461538461538],... 'String','16',... 'Style','edit',... 'Value',440,... 'CreateFcn','samplexpogui(''nbits_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','nbits'); h34 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','samplexpogui(''nbitsslider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',16,... 'Min',1,... 'Position',[59 10.5384615384615 44 0.846153846153846],... 'String','16',... 'Style','slider',... 'SliderStep',[0.0625 0.1],... 'Value',16,... 'CreateFcn','samplexpogui(''nbitsslider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','nbitsslider'); h35 = axes(... 'Parent',h1,... 'Units','characters',... 'ALim',get(0,'defaultaxesALim'),... 'ALimMode','manual',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode','manual',... 'CameraTarget',[0.5 0.5 0.5],... 'CameraTargetMode','manual',... 'CameraUpVector',[0 1 0],... 'CameraUpVectorMode','manual',... 'CameraViewAngle',6.60861036031192,... 'CameraViewAngleMode','manual',... 'CLim',get(0,'defaultaxesCLim'),... 'CLimMode','manual',... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'DataAspectRatio',get(0,'defaultaxesDataAspectRatio'),... 'DataAspectRatioMode','manual',... 'PlotBoxAspectRatio',get(0,'defaultaxesPlotBoxAspectRatio'),... 'PlotBoxAspectRatioMode','manual',... 'Position',[10.2 20 103 16.0769230769231],... 'TickDir',get(0,'defaultaxesTickDir'),... 'TickDirMode','manual',... 'XColor',get(0,'defaultaxesXColor'),... 'XLim',get(0,'defaultaxesXLim'),... 'XLimMode','manual',... 'XTick',[0 0.2 0.4 0.6 0.8 1],... 'XTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'XTickLabelMode','manual',... 'XTickMode','manual',... 'YColor',get(0,'defaultaxesYColor'),... 'YLim',get(0,'defaultaxesYLim'),... 'YLimMode','manual',... 'YTick',[0 0.2 0.4 0.6 0.8 1],... 'YTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'YTickLabelMode','manual',... 'YTickMode','manual',... 'ZColor',get(0,'defaultaxesZColor'),... 'ZLim',get(0,'defaultaxesZLim'),... 'ZLimMode','manual',... 'ZTick',[0 0.5 1],... 'ZTickLabel','',... 'ZTickLabelMode','manual',... 'ZTickMode','manual',... 'Tag','interplot',... 'UserData',[]); h36 = get(h35,'title'); set(h36,... 'Parent',h35,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.494818652849741 1.02849740932642 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h37 = get(h35,'xlabel'); set(h37,... 'Parent',h35,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.494818652849741 -0.101036269430052 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h38 = get(h35,'ylabel'); set(h38,... 'Parent',h35,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.121761658031088 0.494818652849741 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h39 = get(h35,'zlabel'); set(h39,... 'Parent',h35,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-1.24093264248705 2.10621761658031 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h40 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','samplexpogui(''wave_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[73.4 2 15 1.61538461538462],... 'String',{ 'Sine'; 'Triangle'; 'Sawtooth'; 'Square' },... 'Style','popupmenu',... 'Value',1,... 'CreateFcn','samplexpogui(''wave_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','wave'); h41 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'HorizontalAlignment','right',... 'ListboxTop',0,... 'Position',[57.2 2.15384615384615 14.6 1.46153846153846],... 'String','Waveform',... 'Style','text',... 'Tag','text17'); h42 = uimenu(... 'Parent',h1,... 'Callback','samplexpogui(''help_Callback'',gcbo,[],guidata(gcbo))',... 'Label','Help',... 'Tag','help'); hsingleton = h1; % --- Handles default GUIDE GUI creation and callback dispatch function varargout = gui_mainfcn(gui_State, varargin) gui_StateFields = {'gui_Name' 'gui_Singleton' 'gui_OpeningFcn' 'gui_OutputFcn' 'gui_LayoutFcn' 'gui_Callback'}; gui_Mfile = ''; for i=1:length(gui_StateFields) if ~isfield(gui_State, gui_StateFields{i}) error('Could not find field %s in the gui_State struct in GUI M-file %s', gui_StateFields{i}, gui_Mfile); elseif isequal(gui_StateFields{i}, 'gui_Name') gui_Mfile = [getfield(gui_State, gui_StateFields{i}), '.m']; end end numargin = length(varargin); if numargin == 0 % SAMPLEXPOGUI % create the GUI gui_Create = 1; elseif numargin > 3 & ischar(varargin{1}) & ishandle(varargin{2}) % SAMPLEXPOGUI('CALLBACK',hObject,eventData,handles,...) gui_Create = 0; else % SAMPLEXPOGUI(...) % create the GUI and hand varargin to the openingfcn gui_Create = 1; end if gui_Create == 0 varargin{1} = gui_State.gui_Callback; if nargout [varargout{1:nargout}] = feval(varargin{:}); else feval(varargin{:}); end else if gui_State.gui_Singleton gui_SingletonOpt = 'reuse'; else gui_SingletonOpt = 'new'; end % Open fig file with stored settings. Note: This executes all component % specific CreateFunctions with an empty HANDLES structure. % Do feval on layout code in m-file if it exists if ~isempty(gui_State.gui_LayoutFcn) gui_hFigure = feval(gui_State.gui_LayoutFcn, gui_SingletonOpt); else gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt); % If the figure has InGUIInitialization it was not completely created % on the last pass. Delete this handle and try again. if isappdata(gui_hFigure, 'InGUIInitialization') delete(gui_hFigure); gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt); end end % Set flag to indicate starting GUI initialization setappdata(gui_hFigure,'InGUIInitialization',1); % Fetch GUIDE Application options gui_Options = getappdata(gui_hFigure,'GUIDEOptions'); if ~isappdata(gui_hFigure,'GUIOnScreen') % Adjust background color if gui_Options.syscolorfig set(gui_hFigure,'Color', get(0,'DefaultUicontrolBackgroundColor')); end % Generate HANDLES structure and store with GUIDATA guidata(gui_hFigure, guihandles(gui_hFigure)); end % If user specified 'Visible','off' in p/v pairs, don't make the figure % visible. gui_MakeVisible = 1; for ind=1:2:length(varargin) if length(varargin) == ind break; end len1 = min(length('visible'),length(varargin{ind})); len2 = min(length('off'),length(varargin{ind+1})); if ischar(varargin{ind}) & ischar(varargin{ind+1}) & ... strncmpi(varargin{ind},'visible',len1) & len2 > 1 if strncmpi(varargin{ind+1},'off',len2) gui_MakeVisible = 0; elseif strncmpi(varargin{ind+1},'on',len2) gui_MakeVisible = 1; end end end % Check for figure param value pairs for index=1:2:length(varargin) if length(varargin) == index break; end try, set(gui_hFigure, varargin{index}, varargin{index+1}), catch, break, end end % If handle visibility is set to 'callback', turn it on until finished % with OpeningFcn gui_HandleVisibility = get(gui_hFigure,'HandleVisibility'); if strcmp(gui_HandleVisibility, 'callback') set(gui_hFigure,'HandleVisibility', 'on'); end feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:}); if ishandle(gui_hFigure) % Update handle visibility set(gui_hFigure,'HandleVisibility', gui_HandleVisibility); % Make figure visible if gui_MakeVisible set(gui_hFigure, 'Visible', 'on') if gui_Options.singleton setappdata(gui_hFigure,'GUIOnScreen', 1); end end % Done with GUI initialization rmappdata(gui_hFigure,'InGUIInitialization'); end % If handle visibility is set to 'callback', turn it on until finished with % OutputFcn if ishandle(gui_hFigure) gui_HandleVisibility = get(gui_hFigure,'HandleVisibility'); if strcmp(gui_HandleVisibility, 'callback') set(gui_hFigure,'HandleVisibility', 'on'); end gui_Handles = guidata(gui_hFigure); else gui_Handles = []; end if nargout [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles); else feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles); end if ishandle(gui_hFigure) set(gui_hFigure,'HandleVisibility', gui_HandleVisibility); end end function gui_hFigure = local_openfig(name, singleton) try gui_hFigure = openfig(name, singleton, 'auto'); catch % OPENFIG did not accept 3rd input argument until R13, % toggle default figure visible to prevent the figure % from showing up too soon. gui_OldDefaultVisible = get(0,'defaultFigureVisible'); set(0,'defaultFigureVisible','off'); gui_hFigure = openfig(name, singleton); set(0,'defaultFigureVisible',gui_OldDefaultVisible); end