function varargout = gui(varargin)
% GUI M-file for gui.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI.M with the given input arguments.
%
% GUI('Property','Value',...) creates a new GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui_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 gui
% Last Modified by GUIDE v2.5 28-Aug-2005 19:03:15
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui_OpeningFcn, ...
'gui_OutputFcn', @gui_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 gui is made visible.
function gui_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 gui (see VARARGIN)
% Choose default command line output for gui
handles.output = hObject;
% Make the My notch Radio Button Active...
set(handles.rbmynotch,'Value',1);
set(handles.rbsptoolnotch,'Value',0);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = gui_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)
%================================================================
%================================================================
% Update the y1 Figures...
%================================================================
%================================================================
if ~exist('filt1') || ~exist('filt2') || ~exist('filt3') || ~exist('filt4') || ~exist('filt5') || ~exist('filt6') || ~exist('filt7') ,
disp('No Filters load them...')
load filter_bank.mat
end
fs=8192;
% Frequency
axes(handles.y1);
[H,w] = freqz(filt1.tf.num,filt1.tf.den,512);
plot(w*fs/(2*pi),abs(H));grid;
xlabel('Frequence');ylabel('Amplitude');
axes(handles.y2);
[H,w] = freqz(filt2.tf.num,filt2.tf.den,512);
plot(w*fs/(2*pi),abs(H));grid;
xlabel('Frequence');ylabel('Amplitude');
axes(handles.y3);
[H,w] = freqz(filt3.tf.num,filt3.tf.den,512);
plot(w*fs/(2*pi),abs(H));grid;
xlabel('Frequence');ylabel('Amplitude');
axes(handles.y4);
[H,w] = freqz(filt4.tf.num,filt4.tf.den,512);
plot(w*fs/(2*pi),abs(H));grid;
xlabel('Frequence');ylabel('Amplitude');
axes(handles.y5);
[H,w] = freqz(filt5.tf.num,filt5.tf.den,512);
plot(w*fs/(2*pi),abs(H));grid;
xlabel('Frequence');ylabel('Amplitude');
axes(handles.y6);
[H,w] = freqz(filt6.tf.num,filt6.tf.den,512);
plot(w*fs/(2*pi),abs(H));grid;
xlabel('Frequence');ylabel('Amplitude');
axes(handles.y7);
[H,w] = freqz(filt7.tf.num,filt7.tf.den,512);
plot(w*fs/(2*pi),abs(H));grid;
xlabel('Frequence');ylabel('Amplitude');
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in b1.
function b1_Callback(hObject, eventdata, handles)
% hObject handle to b1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(1);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b2.
function b2_Callback(hObject, eventdata, handles)
% hObject handle to b2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(2);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b3.
function b3_Callback(hObject, eventdata, handles)
% hObject handle to b3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(3);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b4.
function b4_Callback(hObject, eventdata, handles)
% hObject handle to b4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(4);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b5.
function b5_Callback(hObject, eventdata, handles)
% hObject handle to b5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(5);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b6.
function b6_Callback(hObject, eventdata, handles)
% hObject handle to b6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(6);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
%--- Executes on button press in b7.
function b7_Callback(hObject, eventdata, handles)
% hObject handle to b7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(7);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b8.
function b8_Callback(hObject, eventdata, handles)
% hObject handle to b8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(8);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b9.
function b9_Callback(hObject, eventdata, handles)
% hObject handle to b9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(9);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in ba.
function bstar_Callback(hObject, eventdata, handles)
% hObject handle to bstar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad('*');
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in b0.
function b0_Callback(hObject, eventdata, handles)
% hObject handle to b0 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad(0);
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in bn.
function bcell_Callback(hObject, eventdata, handles)
% hObject handle to bcell (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[n,signal]=phone_pad('#');
myfilter=get(handles.rbmynotch,'Value');
update_gui_bank
% --- Executes on button press in info.
function info_Callback(hObject, eventdata, handles)
% hObject handle to info (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
msgbox('File was created by: Zouzias Anastasios CEID University of Patras Greece','Info','warn')
% --- Executes on button press in close.
function close_Callback(hObject, eventdata, handles)
% hObject handle to close (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close;
% --- Executes during object creation, after setting all properties.
function energy1_CreateFcn(hObject, eventdata, handles)
% hObject handle to energy1 (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 energy1_Callback(hObject, eventdata, handles)
% hObject handle to energy1 (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 energy1 as text
% str2double(get(hObject,'String')) returns contents of energy1 as a double
% --- Executes during object creation, after setting all properties.
function energy2_CreateFcn(hObject, eventdata, handles)
% hObject handle to energy2 (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 energy2_Callback(hObject, eventdata, handles)
% hObject handle to energy2 (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 energy2 as text
% str2double(get(hObject,'String')) returns contents of energy2 as a double
% --- Executes during object creation, after setting all properties.
function energy3_CreateFcn(hObject, eventdata, handles)
% hObject handle to energy3 (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 energy3_Callback(hObject, eventdata, handles)
% hObject handle to energy3 (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 energy3 as text
% str2double(get(hObject,'String')) returns contents of energy3 as a double
% --- Executes during object creation, after setting all properties.
function energy4_CreateFcn(hObject, eventdata, handles)
% hObject handle to energy4 (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 energy4_Callback(hObject, eventdata, handles)
% hObject handle to energy4 (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 energy4 as text
% str2double(get(hObject,'String')) returns contents of energy4 as a double
% --- Executes during object creation, after setting all properties.
function energy5_CreateFcn(hObject, eventdata, handles)
% hObject handle to energy5 (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 energy5_Callback(hObject, eventdata, handles)
% hObject handle to energy5 (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 energy5 as text
% str2double(get(hObject,'String')) returns contents of energy5 as a double
% --- Executes during object creation, after setting all properties.
function energy6_CreateFcn(hObject, eventdata, handles)
% hObject handle to energy6 (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 energy6_Callback(hObject, eventdata, handles)
% hObject handle to energy6 (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 energy6 as text
% str2double(get(hObject,'String')) returns contents of energy6 as a double
% --- Executes during object creation, after setting all properties.
function energy7_CreateFcn(hObject, eventdata, handles)
% hObject handle to energy7 (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 energy7_Callback(hObject, eventdata, handles)
% hObject handle to energy7 (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 energy7 as text
% str2double(get(hObject,'String')) returns contents of energy7 as a double
% --- Executes during object creation, after setting all properties.
function EditPressed_CreateFcn(hObject, eventdata, handles)
% hObject handle to EditPressed (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 EditPressed_Callback(hObject, eventdata, handles)
% hObject handle to EditPressed (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 EditPressed as text
% str2double(get(hObject,'String')) returns contents of EditPressed as a double
% --- Executes on button press in rbsptoolnotch.
function rbsptoolnotch_Callback(hObject, eventdata, handles)
% hObject handle to rbsptoolnotch (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbsptoolnotch
state=get(hObject, 'Value');
if state==0,
set(hObject, 'Value', 1);
else,
set(handles.rbmynotch, 'Value', 0);
% states=ones(23, 1);states([(3:10)])=0;
% handles=activate_uicontrol(states, handles);
end
guidata(hObject, handles);
% --- Executes on button press in rbmynotch.
function rbmynotch_Callback(hObject, eventdata, handles)
% hObject handle to rbmynotch (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbmynotch
state=get(hObject, 'Value');
if state==0,
set(hObject, 'Value', 1);
else,
set(handles.rbsptoolnotch, 'Value', 0);
% states=ones(23, 1);states([(3:10)])=0;
% handles=activate_uicontrol(states, handles);
end
guidata(hObject, handles);