function varargout = Spectrogram_sounds(varargin)

%%%Dr. Ignacio Serrano-Pedraza 2018
%%%iserrano@ucm.es


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

% Last Modified by GUIDE v2.5 13-Mar-2018 17:22:18

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Spectrogram_sounds_OpeningFcn, ...
    'gui_OutputFcn',  @Spectrogram_sounds_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 Spectrogram_sounds is made visible.
function Spectrogram_sounds_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 Spectrogram_sounds (see VARARGIN)

% Choose default command line output for Spectrogram_sounds
handles.output = hObject;
% Play_sound handles structure
guidata(hObject, handles);
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


function Plot_figure(hObject, eventdata, handles,playsound,playsound2)
expt = getexpt(handles);


loadsounds_index = get(handles.loadsounds, 'Value');

switch loadsounds_index
    
    case 1
        [YY FS] = audioread('SOUNDS/nine.wav');
        YY=YY(:,1);
        [P,Q] = rat(8000/FS);
        FS=8000;
        YY=resample(YY,P,Q);
    case 2
        [YY FS] = audioread('SOUNDS/Beat.wav');
    case 3
        [YY FS] = audioread('SOUNDS/chirp.wav');
    case 4
        [YY FS] = audioread('SOUNDS/Justin1.wav');
        YY=YY(:,1);
        [P,Q] = rat(11025/FS);
        FS=11025;
        YY=resample(YY,P,Q);
        
    case 5
        [YY FS] = audioread('SOUNDS/nine.wav');
        YY=YY(:,1);
        [P,Q] = rat(8000/FS);
        FS=8000;
        YY=resample(YY,P,Q);
    case 6
        [YY FS] = audioread('SOUNDS/Pure_tone.wav');
    case 7
        [YY FS] = audioread('SOUNDS/Respuesta.wav');
        YY=YY(:,1);
        [P,Q] = rat(8000/FS);
        FS=8000;
        YY=resample(YY,P,Q);
    case 8
        [YY FS] = audioread('SOUNDS/Three_tones.wav');
    case 9
        [YY FS] = audioread('SOUNDS/Two_tones.wav');
    case 10
        [YY FS] = audioread('SOUNDS/Vocal_a_M_long.wav');
        [P,Q] = rat(8000/FS);
        FS=8000;
        YY=resample(YY,P,Q);
    case 11
        [YY FS] = audioread('SOUNDS/Vocal_a_M_short.wav');
        [P,Q] = rat(8000/FS);
        FS=8000;
        YY=resample(YY,P,Q);
    case 12
        [YY FS] = audioread('SOUNDS/Vocal_e_M_long.wav');
        YY=YY(:,1);
        [P,Q] = rat(8000/FS);
        FS=8000;
        YY=resample(YY,P,Q);
    case 13
        [YY FS] = audioread('SOUNDS/Vocal_a.wav');
    case 14
        [YY FS] = audioread('SOUNDS/Vocal_e.wav');
    case 15
        [YY FS] = audioread('SOUNDS/Vocal_i.wav');
    case 16
        [YY FS] = audioread('SOUNDS/Vocal_o.wav');
    case 17
        [YY FS] = audioread('SOUNDS/Vocal_u.wav');
    case 18
        [YY FS] = audioread('SOUNDS/white_noise.wav');
        
end


frecuenciamuestreo=FS;
duracion=length(YY)/FS; %seconds
t=[0:1/frecuenciamuestreo:duracion-(1/frecuenciamuestreo)]';
n=frecuenciamuestreo*duracion;
freq=(-fix(n/2):fix((n-1)/2))/duracion;

%%%%%%%%%%%%%%%%%%%%%%%%% BUTTERWORTH FILTERS%%%%%%%%%%%%%%%%%%%%%%%%%%%

r=expt.filterorder;%%ORDER

if expt.radiobuttonLP==1
    rhon=expt.lowSF;
    filtro=(1+((sqrt(freq.^2)./rhon)).^(2*r)).^-1;%%LOW-PASS filter Butterworth
    
end
if expt.radiobuttonHP==1
    rhon=expt.highSF;
    filtro=(1+((rhon./sqrt(freq.^2))).^(2*r)).^-1;%%HIGH-PASS Butterworth filter
end
if expt.radiobuttonBP==1
    rhon=expt.centerBP;
    filtro=(1+((sqrt(freq.^2)-rhon)./expt.bandwidth).^(2*r)).^-1; %BAND-PASS FILTER Butterworth
end
if expt.radiobuttonNN==1
    rhon=expt.centerNN;
    filtro=1-(1+((sqrt(freq.^2)-rhon)./expt.bandwidthNN).^(2*r)).^-1; %NOTCHED FILTER Butterworth
    
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

n=frecuenciamuestreo*duracion;
freq=(-fix(n/2):fix((n-1)/2))/duracion;
FFT=fftshift(fft(YY));
modulo=abs(FFT)';
fase=angle(FFT)';


REALPROD=fftshift(modulo.*filtro.*cos(fase));
IMAGPROD=fftshift(modulo.*filtro.*sin(fase));

RESULTADO=(REALPROD+IMAGPROD*sqrt(-1));
FINAL=(ifft(RESULTADO));
y2=real(FINAL);




axes(handles.Plot1);
cla;
plot(t,YY,'b-');
title('Signal')
xlabel('Time (msec)')
ylabel('Amplitude')
axis([0 duracion -1.2 1.2])
if playsound==1
    sound(YY,frecuenciamuestreo)
end


axes(handles.Plot2);
cla;
specgram(YY,256,length(YY)/duracion,256,255)
title('Spectrogram')
xlabel('Time (msec)')
ylabel('Amplitude')


axes(handles.Plot3);
cla;
plot(t,expt.Volumen*y2,'b-');
title('Filtered sound')
xlabel('Time (msec)')
ylabel('Amplitude')
axis([0 duracion -1.2 1.2])
if playsound2==1
    sound(expt.Volumen*y2,frecuenciamuestreo)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


axes(handles.Plot4);
cla;

specgram(y2,256,length(y2)/duracion,256,255)
title('Spectrogram of filtered sound')
xlabel('Time (msec)')
ylabel('Amplitude')







% --- Outputs from this function are returned to the command line.
function varargout = Spectrogram_sounds_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 Play_sound.
function Play_sound_Callback(hObject, eventdata, handles)
% hObject    handle to Play_sound (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
playsound=1;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)



% --------------------------------------------------------------------
function OpenMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to OpenMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
file = uigetfile('*.fig');
if ~isequal(file, 0)
    open(file);
end



function expt = getexpt(handles)
% Reads off key data from GUI
A = get(handles.lowSF,'string');
expt.lowSF = str2double(A);
A = get(handles.highSF,'string');
expt.highSF = str2double(A);
A = get(handles.centerBP,'string');
expt.centerBP = str2double(A);
A = get(handles.bandwidth,'string');
expt.bandwidth = str2double(A);
A = get(handles.centerNN,'string');
expt.centerNN = str2double(A);
A = get(handles.bandwidthNN,'string');
expt.bandwidthNN = str2double(A);
filterorder = get(handles.filterorder,'string');
expt.filterorder = str2double(filterorder);
expt.Volumen = get(handles.Volumen,'value');


expt.radiobuttonLP= get(handles.radiobuttonLP,'value');
expt.radiobuttonHP= get(handles.radiobuttonHP,'value');
expt.radiobuttonBP= get(handles.radiobuttonBP,'value');
expt.radiobuttonNN= get(handles.radiobuttonNN,'value');





% --- Executes on button press in Plot_figure.
function Plot_figure_Callback(hObject, eventdata, handles)
% hObject    handle to Plot_figure (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


function CloseMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to CloseMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
selection = questdlg(['Close ' get(handles.axixX,'Name') '?'],...
    ['Close ' get(handles.axixX,'Name') '...'],...
    'Yes','No','Yes');
if strcmp(selection,'No')
    return;
end

delete(handles.axixX)
% --------------------------------------------------------------------
function PrintMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to PrintMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
printdlg(handles.axixX)

% --------------------------------------------------------------------
function FileMenu_Callback(hObject, eventdata, handles)
% hObject    handle to FileMenu (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 Reset.
function Reset_Callback(hObject, eventdata, handles)
% hObject    handle to Reset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

set(handles.Volumen,'Value',1);
set(handles.radiobuttonLP,'Value',1);
set(handles.radiobuttonHP,'Value',0);
set(handles.radiobuttonBP,'Value',0);
set(handles.radiobuttonNN,'Value',0);

set(handles.lowSF, 'String', 500);
set(handles.highSF, 'String', 2000);
set(handles.centerBP, 'String', 1500);
set(handles.bandwidth, 'String', 500);
set(handles.centerNN, 'String', 1000);
set(handles.bandwidthNN, 'String', 400);
set(handles.filterorder, 'String', 40);

playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)

% --- Executes on button press in radiobuttonLP.
function radiobuttonLP_Callback(hObject, eventdata, handles)
% hObject    handle to radiobuttonLP (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 radiobuttonLP
set(handles.radiobuttonHP,'Value',0);
set(handles.radiobuttonBP,'Value',0);
set(handles.radiobuttonNN,'Value',0);
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes on button press in radiobuttonHP.
function radiobuttonHP_Callback(hObject, eventdata, handles)
% hObject    handle to radiobuttonHP (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 radiobuttonHP
set(handles.radiobuttonLP,'Value',0);
set(handles.radiobuttonBP,'Value',0);
set(handles.radiobuttonNN,'Value',0);
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes on button press in radiobuttonBP.
function radiobuttonBP_Callback(hObject, eventdata, handles)
% hObject    handle to radiobuttonBP (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 radiobuttonBP
set(handles.radiobuttonLP,'Value',0);
set(handles.radiobuttonHP,'Value',0);
set(handles.radiobuttonNN,'Value',0);
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


function lowSF_Callback(hObject, eventdata, handles)
% hObject    handle to lowSF (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 lowSF as text
%        str2double(get(hObject,'String')) returns contents of lowSF as a double
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function lowSF_CreateFcn(hObject, eventdata, handles)
% hObject    handle to lowSF (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 highSF_Callback(hObject, eventdata, handles)
% hObject    handle to highSF (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 highSF as text
%        str2double(get(hObject,'String')) returns contents of highSF as a double
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function highSF_CreateFcn(hObject, eventdata, handles)
% hObject    handle to highSF (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 bandwidth_Callback(hObject, eventdata, handles)
% hObject    handle to bandwidth (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 bandwidth as text
%        str2double(get(hObject,'String')) returns contents of bandwidth as a double
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function bandwidth_CreateFcn(hObject, eventdata, handles)
% hObject    handle to bandwidth (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 centerBP_Callback(hObject, eventdata, handles)
% hObject    handle to centerBP (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 centerBP as text
%        str2double(get(hObject,'String')) returns contents of centerBP as a double
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function centerBP_CreateFcn(hObject, eventdata, handles)
% hObject    handle to centerBP (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 radiobuttonNN.
function radiobuttonNN_Callback(hObject, eventdata, handles)
% hObject    handle to radiobuttonNN (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 radiobuttonNN
set(handles.radiobuttonLP,'Value',0);
set(handles.radiobuttonBP,'Value',0);
set(handles.radiobuttonHP,'Value',0);
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)



function centerNN_Callback(hObject, eventdata, handles)
% hObject    handle to centerNN (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 centerNN as text
%        str2double(get(hObject,'String')) returns contents of centerNN as a double
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function centerNN_CreateFcn(hObject, eventdata, handles)
% hObject    handle to centerNN (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 bandwidthNN_Callback(hObject, eventdata, handles)
% hObject    handle to bandwidthNN (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 bandwidthNN as text
%        str2double(get(hObject,'String')) returns contents of bandwidthNN as a double
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function bandwidthNN_CreateFcn(hObject, eventdata, handles)
% hObject    handle to bandwidthNN (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 Play_sound2.
function Play_sound2_Callback(hObject, eventdata, handles)
% hObject    handle to Play_sound2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
playsound2=1;
playsound=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes on selection change in loadsounds.
function loadsounds_Callback(hObject, eventdata, handles)
% hObject    handle to loadsounds (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns loadsounds contents as cell array
%        contents{get(hObject,'Value')} returns selected item from loadsounds
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)

% --- Executes during object creation, after setting all properties.
function loadsounds_CreateFcn(hObject, eventdata, handles)
% hObject    handle to loadsounds (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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 filterorder_Callback(hObject, eventdata, handles)
% hObject    handle to filterorder (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 filterorder as text
%        str2double(get(hObject,'String')) returns contents of filterorder as a double
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function filterorder_CreateFcn(hObject, eventdata, handles)
% hObject    handle to filterorder (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 slider movement.
function Volumen_Callback(hObject, eventdata, handles)
% hObject    handle to Volumen (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
playsound=0;
playsound2=0;
Plot_figure(hObject, eventdata, handles,playsound,playsound2)


% --- Executes during object creation, after setting all properties.
function Volumen_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Volumen (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end
