function varargout = bams(varargin) % BAMS M-file for bams.fig % BAMS, by itself, creates a new BAMS or raises the existing % singleton*. % % H = BAMS returns the handle to a new BAMS or the handle to % the existing singleton*. % % BAMS('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in BAMS.M with the given input arguments. % % BAMS('Property','Value',...) creates a new BAMS or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before bams_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to bams_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 bams % Last Modified by GUIDE v2.5 06-Apr-2005 09:31:16 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @bams_OpeningFcn, ... 'gui_OutputFcn', @bams_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 bams is made visible. function bams_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 bams (see VARARGIN) % Choose default command line output for bams handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes bams wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = bams_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 on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (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 pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) t=linspace(0,1,1024); sig = sqrt(t.*(1-t)).*sin((2*pi*1.05) ./(t+.05)); handles.sig=sig; handles.t=t; guidata(hObject,handles); axes(handles.axes1) plot(t, sig) ylim([-1,1]) % --- Executes on button press in pushbutton5. function pushbutton5_Callback(hObject, eventdata, handles) % hObject handle to pushbutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) SNR = str2double(get(handles.std_input,'String')); randn('seed',1); %SNR = 7; %signal = MakeSignal('Blocks', N); sigma = std(handles.sig); %signal = signal.*SNR/sigma; %noise = randn(1,N); %data = signal + noise; handles.sig = SNR/sigma .* handles.sig sign = handles.sig + randn(size(handles.sig)); handles.sign=sign; guidata(hObject,handles); axes(handles.axes2) plot(handles.t, sign) % --- Executes during object creation, after setting all properties. function pushbutton4_CreateFcn(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % --- Executes during object creation, after setting all properties. function axes1_CreateFcn(hObject, eventdata, handles) % hObject handle to axes1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: place code in OpeningFcn to populate axes1 % --- Executes on mouse press over axes background. function axes1_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to axes1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton4. function pushbutton4_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to pushbutton4 (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 pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) f=BAMS_alone(handles.sign); axes(handles.axes3) plot(handles.t, f) % --- Executes during object creation, after setting all properties. function std_input_CreateFcn(hObject, eventdata, handles) % hObject handle to std_input (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 std_input_Callback(hObject, eventdata, handles) % hObject handle to std_input (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 std_input as text % str2double(get(hObject,'String')) returns contents of std_input as a double