www.gusucode.com > 实现一个数字信号处理的仿真系统matlab源码程序 > code/filterfig.m
function varargout = filterfig(varargin) % FILTERFIG M-file for filterfig.fig % FILTERFIG, by itself, creates a new FILTERFIG or raises the existing % singleton*. % % H = FILTERFIG returns the handle to a new FILTERFIG or the handle to % the existing singleton*. % % FILTERFIG('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in FILTERFIG.M with the given input arguments. % % FILTERFIG('Property','Value',...) creates a new FILTERFIG or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before filterfig_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to filterfig_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 % Edit the above text to modify the response to help filterfig % Last Modified by GUIDE v2.5 26-Aug-2011 11:51:06 % Begin initialization code - DO NOT EDIT global b; global out; global t; global nak; gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @filterfig_OpeningFcn, ... 'gui_OutputFcn', @filterfig_OutputFcn, ... 'gui_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 filterfig is made visible. function filterfig_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to filterfig (see VARARGIN) % Choose default command line output for filterfig handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes filterfig wait for user response (see UIRESUME) % uiwait(handles.filterfig_figure); % --- Outputs from this function are returned to the command line. function varargout = filterfig_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; % --- Executes during object creation, after setting all properties. function cut_edit_CreateFcn(hObject, eventdata, handles) % hObject handle to cut_edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit 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 function cut_edit_Callback(hObject, eventdata, handles) frecut=str2num(get(handles.cut_edit,'String')); % hObject handle to cut_edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of cut_edit as text % str2double(get(hObject,'String')) returns contents of cut_edit as a double % --- Executes on button press in lpf_button. function lpf_button_Callback(hObject, eventdata, handles) global b; frecut=str2num(get(handles.cut_edit,'String')); Window=boxcar(65); b=fir1(64,frecut,Window); fig=openfig('amppha.fig'); handles = guihandles(fig); guidata(fig, handles); freqz(b,1,512); %findobj('tag','amppha_axes'); %plot(abs(H),'parent',handles.noifil_axes); %findobj('tag','mixfil_axes'); %plot(W,'parent',handles.mixfil_axes); % hObject handle to lpf_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in hpf_button. function hpf_button_Callback(hObject, eventdata, handles) global b; frecut=str2num(get(handles.cut_edit,'String')); Window=boxcar(65); b=fir1(64,frecut,'high',Window); fig=openfig('amppha.fig'); handles = guihandles(fig); guidata(fig, handles); freqz(b,1,512); % hObject handle to hpf_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in bpf_button. function bpf_button_Callback(hObject, eventdata, handles) global b; frecut=str2num(get(handles.cut_edit,'String')); Window=boxcar(65); b=fir1(64,frecut,Window); fig=openfig('amppha.fig'); handles = guihandles(fig); guidata(fig, handles); freqz(b,1,512); % hObject handle to bpf_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in bsf_button. function bsf_button_Callback(hObject, eventdata, handles) global b; frecut=str2num(get(handles.cut_edit,'String')); Window=boxcar(65); b=fir1(64,frecut,'stop',Window); fig=openfig('amppha.fig'); handles = guihandles(fig); guidata(fig, handles); freqz(b,1,512); % hObject handle to bsf_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in back1_button. function back1_button_Callback(hObject, eventdata, handles) fig=openfig('main.fig'); handles = guihandles(fig); guidata(fig, handles); % hObject handle to back1_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in next1_button. function next1_button_Callback(hObject, eventdata, handles) fig=openfig('fftpin.fig'); handles = guihandles(fig); guidata(fig, handles); % hObject handle to next1_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in quit1_button. function quit1_button_Callback(hObject, eventdata, handles) close all; % hObject handle to quit1_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in noifil_button. function noifil_button_Callback(hObject, eventdata, handles) global nak; global z; global b; global t; t=0:1/nak:15; out1=filter(b,1,z); findobj('tag','noifil_axes'); plot(t,out1,'parent',handles.noifil_axes); % hObject handle to noifil_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in mixfil_button. function mixfil_button_Callback(hObject, eventdata, handles) global mix; global b; global out; global nak; global t; t=0:1/nak:15; out=filter(b,1,mix); findobj('tag','mixfil_axes'); plot(t,out,'parent',handles.mixfil_axes); % hObject handle to mixfil_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)