function varargout = fdnjotgui(varargin)
% FDNJOTGUI M-file for fdnjotgui.fig
%      FDNJOTGUI, by itself, creates a new FDNJOTGUI or raises the existing
%      singleton*.
%
%      H = FDNJOTGUI returns the handle to a new FDNJOTGUI or the handle to
%      the existing singleton*.
%
%      FDNJOTGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in FDNJOTGUI.M with the given input arguments.
%
%      FDNJOTGUI('Property','Value',...) creates a new FDNJOTGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before fdnjotgui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to fdnjotgui_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 fdnjotgui

% Last Modified by GUIDE v2.5 23-May-2014 00:06:07

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @fdnjotgui_OpeningFcn, ...
                   'gui_OutputFcn',  @fdnjotgui_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(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 fdnjotgui is made visible.
function fdnjotgui_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 fdnjotgui (see VARARGIN)

% Choose default command line output for fdnjotgui
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes fdnjotgui wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = fdnjotgui_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 k1_Callback(hObject, eventdata, handles)
% hObject    handle to k1 (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 k1 as text
%        str2double(get(hObject,'String')) returns contents of k1 as a double


% --- Executes during object creation, after setting all properties.
function k1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k2_Callback(hObject, eventdata, handles)
% hObject    handle to k2 (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 k2 as text
%        str2double(get(hObject,'String')) returns contents of k2 as a double


% --- Executes during object creation, after setting all properties.
function k2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k3_Callback(hObject, eventdata, handles)
% hObject    handle to k3 (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 k3 as text
%        str2double(get(hObject,'String')) returns contents of k3 as a double


% --- Executes during object creation, after setting all properties.
function k3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k3 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k7_Callback(hObject, eventdata, handles)
% hObject    handle to k7 (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 k7 as text
%        str2double(get(hObject,'String')) returns contents of k7 as a double


% --- Executes during object creation, after setting all properties.
function k7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k7 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k8_Callback(hObject, eventdata, handles)
% hObject    handle to k8 (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 k8 as text
%        str2double(get(hObject,'String')) returns contents of k8 as a double


% --- Executes during object creation, after setting all properties.
function k8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k8 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k4_Callback(hObject, eventdata, handles)
% hObject    handle to k4 (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 k4 as text
%        str2double(get(hObject,'String')) returns contents of k4 as a double


% --- Executes during object creation, after setting all properties.
function k4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k4 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k5_Callback(hObject, eventdata, handles)
% hObject    handle to k5 (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 k5 as text
%        str2double(get(hObject,'String')) returns contents of k5 as a double


% --- Executes during object creation, after setting all properties.
function k5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k5 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k6_Callback(hObject, eventdata, handles)
% hObject    handle to k6 (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 k6 as text
%        str2double(get(hObject,'String')) returns contents of k6 as a double


% --- Executes during object creation, after setting all properties.
function k6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k6 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function RT_Callback(hObject, eventdata, handles)
% hObject    handle to RT (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 RT as text
%        str2double(get(hObject,'String')) returns contents of RT as a double


% --- Executes during object creation, after setting all properties.
function RT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to RT (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function EDT_Callback(hObject, eventdata, handles)
% hObject    handle to EDT (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 EDT as text
%        str2double(get(hObject,'String')) returns contents of EDT as a double


% --- Executes during object creation, after setting all properties.
function EDT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EDT (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function BR_Callback(hObject, eventdata, handles)
% hObject    handle to BR (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 BR as text
%        str2double(get(hObject,'String')) returns contents of BR as a double


% --- Executes during object creation, after setting all properties.
function BR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to BR (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function HFR_Callback(hObject, eventdata, handles)
% hObject    handle to HFR (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 HFR as text
%        str2double(get(hObject,'String')) returns contents of HFR as a double


% --- Executes during object creation, after setting all properties.
function HFR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to HFR (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function C7_Callback(hObject, eventdata, handles)
% hObject    handle to C7 (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 C7 as text
%        str2double(get(hObject,'String')) returns contents of C7 as a double


% --- Executes during object creation, after setting all properties.
function C7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C7 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function C50_Callback(hObject, eventdata, handles)
% hObject    handle to C50 (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 C50 as text
%        str2double(get(hObject,'String')) returns contents of C50 as a double


% --- Executes during object creation, after setting all properties.
function C50_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C50 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function C80_Callback(hObject, eventdata, handles)
% hObject    handle to C80 (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 C80 as text
%        str2double(get(hObject,'String')) returns contents of C80 as a double


% --- Executes during object creation, after setting all properties.
function C80_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C80 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function ts_Callback(hObject, eventdata, handles)
% hObject    handle to ts (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 ts as text
%        str2double(get(hObject,'String')) returns contents of ts as a double


% --- Executes during object creation, after setting all properties.
function ts_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ts (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function H_Callback(hObject, eventdata, handles)
% hObject    handle to H (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 H as text
%        str2double(get(hObject,'String')) returns contents of H as a double


% --- Executes during object creation, after setting all properties.
function H_CreateFcn(hObject, eventdata, handles)
% hObject    handle to H (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function D50_Callback(hObject, eventdata, handles)
% hObject    handle to D50 (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 D50 as text
%        str2double(get(hObject,'String')) returns contents of D50 as a double


% --- Executes during object creation, after setting all properties.
function D50_CreateFcn(hObject, eventdata, handles)
% hObject    handle to D50 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function ITDG_Callback(hObject, eventdata, handles)
% hObject    handle to ITDG (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 ITDG as text
%        str2double(get(hObject,'String')) returns contents of ITDG as a double


% --- Executes during object creation, after setting all properties.
function ITDG_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ITDG (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function EK_Callback(hObject, eventdata, handles)
% hObject    handle to EK (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 EK as text
%        str2double(get(hObject,'String')) returns contents of EK as a double


% --- Executes during object creation, after setting all properties.
function EK_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EK (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g1_Callback(hObject, eventdata, handles)
% hObject    handle to g1 (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 g1 as text
%        str2double(get(hObject,'String')) returns contents of g1 as a double


% --- Executes during object creation, after setting all properties.
function g1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g2_Callback(hObject, eventdata, handles)
% hObject    handle to g2 (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 g2 as text
%        str2double(get(hObject,'String')) returns contents of g2 as a double


% --- Executes during object creation, after setting all properties.
function g2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g3_Callback(hObject, eventdata, handles)
% hObject    handle to g3 (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 g3 as text
%        str2double(get(hObject,'String')) returns contents of g3 as a double


% --- Executes during object creation, after setting all properties.
function g3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g3 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g7_Callback(hObject, eventdata, handles)
% hObject    handle to g7 (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 g7 as text
%        str2double(get(hObject,'String')) returns contents of g7 as a double


% --- Executes during object creation, after setting all properties.
function g7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g7 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g4_Callback(hObject, eventdata, handles)
% hObject    handle to g4 (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 g4 as text
%        str2double(get(hObject,'String')) returns contents of g4 as a double


% --- Executes during object creation, after setting all properties.
function g4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g4 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g5_Callback(hObject, eventdata, handles)
% hObject    handle to g5 (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 g5 as text
%        str2double(get(hObject,'String')) returns contents of g5 as a double


% --- Executes during object creation, after setting all properties.
function g5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g5 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g6_Callback(hObject, eventdata, handles)
% hObject    handle to g6 (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 g6 as text
%        str2double(get(hObject,'String')) returns contents of g6 as a double


% --- Executes during object creation, after setting all properties.
function g6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g6 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g8_Callback(hObject, eventdata, handles)
% hObject    handle to g8 (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 g8 as text
%        str2double(get(hObject,'String')) returns contents of g8 as a double


% --- Executes during object creation, after setting all properties.
function g8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g8 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k11_Callback(hObject, eventdata, handles)
% hObject    handle to k11 (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 k11 as text
%        str2double(get(hObject,'String')) returns contents of k11 as a double


% --- Executes during object creation, after setting all properties.
function k11_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k11 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k22_Callback(hObject, eventdata, handles)
% hObject    handle to k22 (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 k22 as text
%        str2double(get(hObject,'String')) returns contents of k22 as a double


% --- Executes during object creation, after setting all properties.
function k22_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k22 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k33_Callback(hObject, eventdata, handles)
% hObject    handle to k33 (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 k33 as text
%        str2double(get(hObject,'String')) returns contents of k33 as a double


% --- Executes during object creation, after setting all properties.
function k33_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k33 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k44_Callback(hObject, eventdata, handles)
% hObject    handle to k44 (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 k44 as text
%        str2double(get(hObject,'String')) returns contents of k44 as a double


% --- Executes during object creation, after setting all properties.
function k44_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k44 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k55_Callback(hObject, eventdata, handles)
% hObject    handle to k55 (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 k55 as text
%        str2double(get(hObject,'String')) returns contents of k55 as a double


% --- Executes during object creation, after setting all properties.
function k55_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k55 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k66_Callback(hObject, eventdata, handles)
% hObject    handle to k66 (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 k66 as text
%        str2double(get(hObject,'String')) returns contents of k66 as a double


% --- Executes during object creation, after setting all properties.
function k66_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k66 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k77_Callback(hObject, eventdata, handles)
% hObject    handle to k77 (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 k77 as text
%        str2double(get(hObject,'String')) returns contents of k77 as a double


% --- Executes during object creation, after setting all properties.
function k77_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k77 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k88_Callback(hObject, eventdata, handles)
% hObject    handle to k88 (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 k88 as text
%        str2double(get(hObject,'String')) returns contents of k88 as a double


% --- Executes during object creation, after setting all properties.
function k88_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k88 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k99_Callback(hObject, eventdata, handles)
% hObject    handle to k99 (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 k99 as text
%        str2double(get(hObject,'String')) returns contents of k99 as a double


% --- Executes during object creation, after setting all properties.
function k99_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k99 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k10_Callback(hObject, eventdata, handles)
% hObject    handle to k10 (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 k10 as text
%        str2double(get(hObject,'String')) returns contents of k10 as a double


% --- Executes during object creation, after setting all properties.
function k10_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k10 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g11_Callback(hObject, eventdata, handles)
% hObject    handle to g11 (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 g11 as text
%        str2double(get(hObject,'String')) returns contents of g11 as a double


% --- Executes during object creation, after setting all properties.
function g11_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g11 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g22_Callback(hObject, eventdata, handles)
% hObject    handle to g22 (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 g22 as text
%        str2double(get(hObject,'String')) returns contents of g22 as a double


% --- Executes during object creation, after setting all properties.
function g22_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g22 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g33_Callback(hObject, eventdata, handles)
% hObject    handle to g33 (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 g33 as text
%        str2double(get(hObject,'String')) returns contents of g33 as a double


% --- Executes during object creation, after setting all properties.
function g33_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g33 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g44_Callback(hObject, eventdata, handles)
% hObject    handle to g44 (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 g44 as text
%        str2double(get(hObject,'String')) returns contents of g44 as a double


% --- Executes during object creation, after setting all properties.
function g44_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g44 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g55_Callback(hObject, eventdata, handles)
% hObject    handle to g55 (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 g55 as text
%        str2double(get(hObject,'String')) returns contents of g55 as a double


% --- Executes during object creation, after setting all properties.
function g55_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g55 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g66_Callback(hObject, eventdata, handles)
% hObject    handle to g66 (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 g66 as text
%        str2double(get(hObject,'String')) returns contents of g66 as a double


% --- Executes during object creation, after setting all properties.
function g66_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g66 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g77_Callback(hObject, eventdata, handles)
% hObject    handle to g77 (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 g77 as text
%        str2double(get(hObject,'String')) returns contents of g77 as a double


% --- Executes during object creation, after setting all properties.
function g77_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g77 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g88_Callback(hObject, eventdata, handles)
% hObject    handle to g88 (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 g88 as text
%        str2double(get(hObject,'String')) returns contents of g88 as a double


% --- Executes during object creation, after setting all properties.
function g88_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g88 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g99_Callback(hObject, eventdata, handles)
% hObject    handle to g99 (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 g99 as text
%        str2double(get(hObject,'String')) returns contents of g99 as a double


% --- Executes during object creation, after setting all properties.
function g99_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g99 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g10_Callback(hObject, eventdata, handles)
% hObject    handle to g10 (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 g10 as text
%        str2double(get(hObject,'String')) returns contents of g10 as a double


% --- Executes during object creation, after setting all properties.
function g10_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g10 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
x=handles.x;
p=handles.p;
sound(x,p)

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
y=handles.y;
p=handles.p;
sound(y,p)

% --- 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)
clc;
set(handles.info,'String','Počíta sa impulzná odozva');
drawnow;
x=handles.x;

Td=str2double(get(handles.implength,'String'));
Fvz=str2double(get(handles.Fvz,'String'));
handles.p=Fvz;

k1=str2double(get(handles.k1,'String'));
k2=str2double(get(handles.k2,'String'));
k3=str2double(get(handles.k3,'String'));
k4=str2double(get(handles.k4,'String'));
k5=str2double(get(handles.k5,'String'));
k6=str2double(get(handles.k6,'String'));
k7=str2double(get(handles.k7,'String'));
k8=str2double(get(handles.k8,'String'));

k11=str2double(get(handles.k11,'String'));
k22=str2double(get(handles.k22,'String'));
k33=str2double(get(handles.k33,'String'));
k44=str2double(get(handles.k44,'String'));
k55=str2double(get(handles.k55,'String'));
k66=str2double(get(handles.k66,'String'));
k77=str2double(get(handles.k77,'String'));
k88=str2double(get(handles.k88,'String'));
k99=str2double(get(handles.k99,'String'));
k10=str2double(get(handles.k10,'String'));

g11=str2double(get(handles.g11,'String'));
g22=str2double(get(handles.g22,'String'));
g33=str2double(get(handles.g33,'String'));
g44=str2double(get(handles.g44,'String'));
g55=str2double(get(handles.g55,'String'));
g66=str2double(get(handles.g66,'String'));
g77=str2double(get(handles.g77,'String'));
g88=str2double(get(handles.g88,'String'));
g99=str2double(get(handles.g99,'String'));
g10=str2double(get(handles.g10,'String'));

wet=str2double(get(handles.drywet,'String'));

implength=Td*Fvz;   %dlzka vektoru impulznej odozvy vo vzorkoch
%% prvotne odrazy FIR filter
earlya=1;

earlyb(k11)=g11;  
earlyb(k22)=g22;  
earlyb(k33)=g33;
earlyb(k44)=g44; 
earlyb(k55)=g55;
earlyb(k66)=g66;
earlyb(k77)=g77; 
earlyb(k88)=g88;
earlyb(k99)=g99;
earlyb(k10)=g10;

FIR=impz(earlyb,earlya);
%% definica oneskorenia
oneskorenie=[k1 k2 k3 k4 k5 k6 k7 k8]; %vektor oneskoreni v jednotlivych linkach vektoru 
                                                       % vo vzorkoch
                                                       % -prvocisla
impzasob(1,oneskorenie(1))=1;   
impzasob(2,oneskorenie(2))=1;
impzasob(3,oneskorenie(3))=1;
impzasob(4,oneskorenie(4))=1;
impzasob(5,oneskorenie(5))=1;   
impzasob(6,oneskorenie(6))=1;
impzasob(7,oneskorenie(7))=1;
impzasob(8,oneskorenie(8))=1;

%% vektor zosileni g
g=10.^(-3*oneskorenie/Td/Fvz);    %definicia zosilenia, vztah [4] v kapitole 3
g=g';                       

set(handles.g1,'String',num2str(g(1),3));
set(handles.g2,'String',num2str(g(2),3));
set(handles.g3,'String',num2str(g(3),3));
set(handles.g4,'String',num2str(g(4),3));
set(handles.g5,'String',num2str(g(5),3));
set(handles.g6,'String',num2str(g(6),3));
set(handles.g7,'String',num2str(g(7),3));
set(handles.g8,'String',num2str(g(8),3));

%% matica zosileni
a=-0.25;
A=[0.75 a a a a a a a;
   a a 0.75 a a a a a
   a 0.75 a a a a a a
   a a a a 0.75 a a a
   a a a 0.75 a a a a
   a a a a a a 0.75 a
   a a a a a 0.75 a a
   a a a a a a a 0.75]; 

%% spatna vazba, generovanie impulznej odozvy

for i=1:implength
    
    impzasob(:,i)=impzasob(:,i).*g;             %na patricnu poziciu kde je zpozdenie, vynasobi prislusnym oneskorenieom
                                        
    imp(:,i)=impzasob(:,i);                     % vystup
     
    feedback=impzasob(:,i)'*A;                  % spatna vazba
    impzasob(1,i+oneskorenie(1))=feedback(1);   % nacitanie do impzasobu,mnozenie ozvien v impzasobi, modelovanie echa
    impzasob(2,i+oneskorenie(2))=feedback(2);
    impzasob(3,i+oneskorenie(3))=feedback(3);
    impzasob(4,i+oneskorenie(4))=feedback(4);
    impzasob(5,i+oneskorenie(5))=feedback(5);  
    impzasob(6,i+oneskorenie(6))=feedback(6);
    impzasob(7,i+oneskorenie(7))=feedback(7);
    impzasob(8,i+oneskorenie(8))=feedback(8);
    
end 

% sucet impulznych odoziev z jednotlivych liniek
IR=sum(imp);

%% filtrovanie lowpassom
%%definicia dolnej priepustnosti
fc=3000/Fvz;

gg=2-cos(2*pi*fc)-sqrt(((cos(2*pi*fc)-2)^2)-1);  

bb=[1-gg 0];
aa=[1 -gg];

iLP=impz(bb,aa,implength); % impulzna odozva low pass filtru

IRfinal=conv(IR,iLP);      % filtrovanie impulznej odozvy lowpassom

%paralelne zapojenie FIR filtru, odkomentovat ak ho chce uzivatel pouzit
% a zakomentovat seriove
% q=delay(IRfinal,1571);     % oneskorenie difuzneho dozvuku od prvotnych odrazov
% IRfinal=vektorplus(FIR,q);


% seriove spojenie prvotnych odrazov a difuzneho dozvuku
[IRfinal,FIR]=eqtflength(IRfinal,FIR);
IRfinal=conv(FIR,IRfinal);
I=find(abs(IRfinal)>10^(-5),1,'last');
IRfinal=IRfinal(:,1:I);
%% filtrovanie signalu
if size(x,2)==1
[x,IRfinal]=eqtflength(x,IRfinal);
y=conv(x,IRfinal);

y=vektorplus(wet*y,(1-wet)*x);

%odstrani nuly
I=find(abs(y(1,:))>10^(-5),1,'last');
y=y(:,1:I);
y=y';

elseif size(x,2)~=1
xl=x(:,1);
xr=x(:,2);
[xl,IRfinal]=eqtflength(xl,IRfinal);
y(:,1)=conv(xl,IRfinal);
[xr,IRfinal]=eqtflength(xr,IRfinal);
y(:,2)=conv(xr,IRfinal);

% dry/wet
y(:,1)=vektorplus(wet*y(:,1),(1-wet)*x(:,1));
y(:,2)=vektorplus(wet*y(:,2),(1-wet)*x(:,2));

%odstrani nuly
I=find(abs(y(:,1))>10^(-5),1,'last');
y=y(1:I,:);
end

handles.y=y;
%% vykreslenie impluznej odozvy
n=(1:length(IRfinal));

plot(handles.impz,n/Fvz,IRfinal);
h=title(handles.impz,'\bfImpulzná charakteristika UFDN reverberátoru');
xlabel(handles.impz,'{{\itt}} (s) \rightarrow')
ylabel(handles.impz,'\ith(-) \rightarrow')

%% spektra vstupneho a vystupneho signalu + reverberatoru
Nd=length(IRfinal);
I=fft(IRfinal)/Nd;                                        %výpočet DFT signálu y o délce Nd pomocí FFT, výsledek dělen Nd
I=I(1:(length(I)/2));
n=(1:length(I));
plot(handles.freqz,n/Nd*Fvz,abs(I));
h=title(handles.freqz,'\bfModulová kmitočtová charakteristika reverberátoru');

xlabel(handles.freqz,'{{\itf}} (Hz) \rightarrow')
ylabel(handles.freqz,'Modul (-) \rightarrow')
set(handles.freqz,'xlim',[20 20000])

%% vstupny signal
n=(1:length(x));

plot(handles.input,n/Fvz,x);
h=title(handles.input,'\bfVstupný signál');
xlabel(handles.input,'{{\itt}} (s) \rightarrow')
ylabel(handles.input,'\its(-) \rightarrow')

%% vystupny signal
n=(1:length(y));

plot(n/Fvz,y)
h=title('\bfVýstupny signál');
xlabel('{{\itt}} (s) \rightarrow')
ylabel('\its(-) \rightarrow')

[RT,EDT,C7,C50,C80,D50,H,itdg,BR,HFR,Ts,IACCE,EKdelta] = objective(IRfinal',Fvz)
D50=D50*100;
EK=max(EKdelta);

set(handles.RT,'String',num2str(RT,3));
set(handles.EDT,'String',num2str(EDT,3));
set(handles.BR,'String',num2str(BR,3));
set(handles.HFR,'String',num2str(HFR,3));
set(handles.C7,'String',num2str(C7,3));
set(handles.C50,'String',num2str(C50,3));
set(handles.C80,'String',num2str(C80,3));
set(handles.H,'String',num2str(H,3));
set(handles.ts,'String',num2str(Ts,3));
set(handles.D50,'String',num2str(D50,3));
set(handles.ITDG,'String',num2str(itdg,3));
set(handles.EK,'String',num2str(EK,3));

set(handles.info,'String','Impulzná odozva vypočítaná');
guidata(hObject, handles);
function implength_Callback(hObject, eventdata, handles)
% hObject    handle to implength (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 implength as text
%        str2double(get(hObject,'String')) returns contents of implength as a double


% --- Executes during object creation, after setting all properties.
function implength_CreateFcn(hObject, eventdata, handles)
% hObject    handle to implength (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function Fvz_Callback(hObject, eventdata, handles)
% hObject    handle to Fvz (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 Fvz as text
%        str2double(get(hObject,'String')) returns contents of Fvz as a double


% --- Executes during object creation, after setting all properties.
function Fvz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Fvz (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function drywet_Callback(hObject, eventdata, handles)
% hObject    handle to drywet (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 drywet as text
%        str2double(get(hObject,'String')) returns contents of drywet as a double


% --- Executes during object creation, after setting all properties.
function drywet_CreateFcn(hObject, eventdata, handles)
% hObject    handle to drywet (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- 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)
[filename pathname]=uigetfile({'*.wav'},'Vyber súbor na reverberáciu');
fullpathname=strcat(pathname, filename)

x=wavread(fullpathname);

handles.x=x;

set(handles.info,'String','Súbor načítaný');

guidata(hObject, handles);

