⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spectrumexpo.m

📁 非常好的数字处理教程
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = spectrumexpo(varargin)% SPECTRUMEXPO.m-file for spectrumexpo.fig%      SPECTRUMEXPO, by itself, creates a new SPECTRUMEXPO or raises the existing%      singleton*.%%      H = SPECTRUMEXPO returns the handle to a new SPECTRUMEXPO or the handle to%      the existing singleton*.%%      SPECTRUMEXPO('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in SPECTRUMEXPO.M with the given input arguments.%%      SPECTRUMEXPO('Property','Value',...) creates a new SPECTRUMEXPO or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before spectrumexpo_OpeningFunction gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to spectrumexpo_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 19-Apr-2004 09:24:59% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @spectrumexpo_OpeningFcn, ...                   'gui_OutputFcn',  @spectrumexpo_OutputFcn, ...                   'gui_LayoutFcn',  [] , ...                   'gui_Callback',   []);if nargin & isstr(varargin{1})    gui_State.gui_Callback = str2func(varargin{1});endif 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 spectrumexpo_OpeningFcn(hObject, eventdata, handles, varargin)handles.output = hObject;guidata(hObject, handles);set(gcf,'UserData',handles);spectrumexpofn;%if strcmp(get(hObject,'Visible'),'off')%	update_Callback(hObject, eventdata, handles)%end% --- Outputs from this function are returned to the command line.function varargout = spectrumexpo_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 structurevarargout{1} = handles.output;function popupmenu1_CreateFcn(hObject, eventdata, handles)	if ispc		set(hObject,'BackgroundColor','white');	else		set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));	end	set(hObject, 'String', {'Sum', 'Product'});function popupmenu1_Callback(hObject, eventdata, handles)	spectrumexpofn 'update';function freq1_CreateFcn(hObject, eventdata, handles)	if ispc   	 set(hObject,'BackgroundColor','white');	else  	  set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));	endfunction freq2_CreateFcn(hObject, eventdata, handles)	if ispc  	  set(hObject,'BackgroundColor','white');	else 	   set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));	endfunction amp1_CreateFcn(hObject, eventdata, handles)	if ispc		set(hObject,'BackgroundColor','white');	else	  set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));	endfunction amp2_CreateFcn(hObject, eventdata, handles)	if ispc		set(hObject,'BackgroundColor','white');	else		set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));	endfunction phase1_CreateFcn(hObject, eventdata, handles)if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction phase2_CreateFcn(hObject, eventdata, handles)if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% Executes on textbox entryfunction freq1_Callback(hObject, eventdata, handles)	freq1 = str2double(get(hObject,'String'));	if freq1 < 20.1        freq1 = 20.1;    elseif freq1 > 22042        freq1 = 22042;    end    set(handles.freq1,'String',num2str(freq1));	set(handles.freq1slider,'Value',log2(freq1));	spectrumexpofn 'update';function freq2_Callback(hObject, eventdata, handles)	freq2 = str2double(get(hObject,'String'));	if freq2 < 20.1        freq2 = 20.1;    elseif freq2 > 22042        freq2 = 22042;    end    set(handles.freq2,'String',num2str(freq2));	set(handles.freq2slider,'Value',log2(freq2));	spectrumexpofn 'update';function amp1_Callback(hObject, eventdata, handles)	amp1 = str2double(get(hObject,'String'));	if amp1 < 0        amp1 = 0;    elseif amp1 > 2        amp1 = 2;    end    set(handles.amp1,'String',num2str(amp1));	set(handles.amp1slider,'Value',amp1);	spectrumexpofn 'update';function amp2_Callback(hObject, eventdata, handles)	amp2 = str2double(get(hObject,'String'));	if amp2 < 0        amp2 = 0;    elseif amp2 > 2        amp2 = 2;    end    set(handles.amp2,'String',num2str(amp2));	set(handles.amp2slider,'Value',amp2);	spectrumexpofn 'update';function phase1_Callback(hObject, eventdata, handles)	phase1 = str2double(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);	spectrumexpofn 'update';function phase2_Callback(hObject, eventdata, handles)	phase2 = str2double(get(hObject,'String'));	if phase2 < -180        while phase2 < -180            phase2 = phase2 + 360;        end    elseif phase2 > 180        while phase2 > 180            phase2 = phase2 - 360;        end    end    set(handles.phase2,'String',num2str(phase2));	set(handles.phase2slider,'Value',phase2);	spectrumexpofn '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(2^get(hObject,'Value'));	set(handles.freq1,'String',freq1);	spectrumexpofn '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);	spectrumexpofn '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);	spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function freq2slider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg    set(hObject,'BackgroundColor',[.9 .9 .9]);else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -