Code covered by the BSD License  

Highlights from
AKUZOFT ACOUSTIC SOFTWARE

image thumbnail
from AKUZOFT ACOUSTIC SOFTWARE by Marco Araos
zip file with: Akuzoft archives Manual Akuzoft

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

% Last Modified by GUIDE v2.5 18-Oct-2009 23:22:15

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

clc;
clear global;

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

global MATERIALES ESPESOR1 DENSIDAD1 MODULODEYOUNG1 AMORTIGUAMIENTO1 ESPESOR2 DENSIDAD2 MODULODEYOUNG2 AMORTIGUAMIENTO2 ESPESOR3 DENSIDAD3 MODULODEYOUNG3 AMORTIGUAMIENTO3 ESPESOR4 DENSIDAD4 MODULODEYOUNG4 AMORTIGUAMIENTO4 CA b VCHBOX1 NOMBRE1 NOMBRE2 VCHBOX2 NOMBRE3 NOMBRE4

if exist('PANEL1.mat')
    delete('PANEL1.mat')
end

if exist('PANEL2.mat')
    delete('PANEL2.mat')
end



%CENTRAR VENTANA PRINCIPAL

scrsz = get(0,'ScreenSize');

pos_act=get(handles.figure1,'Position');
xr=scrsz(3) - pos_act(3);
xp=round(xr/2);
yr=scrsz(4) - pos_act(4);
yp=round(yr/2);
set(handles.figure1,'Position',[xp yp pos_act(3) pos_act(4)]);




% VALOR INICIAL CHECKBOX1

set(handles.checkbox1,'Value',0)

% VALOR INICIAL CHECKBOX2

set(handles.checkbox2,'Value',0)


%VALOR INICIAL PARED

set(handles.r1,'Value',1);
set(handles.DF,'enable','off')
CA=100*10^-3;
set(handles.CA,'string',CA/10^-3)
b=600*10^-3;
set(handles.DF,'string',b/10^-3)


%CENTRAR VENTANA PRINCIPAL

scrsz = get(0,'ScreenSize');
pos_act=get(handles.figure1,'Position');
xr=scrsz(3) - pos_act(3);
xp=round(xr/2);
yr=scrsz(4) - pos_act(4);
yp=round(yr/2);
set(handles.figure1,'Position',[xp yp pos_act(3) pos_act(4)]);

%CARGAR BASE DE DATOS

MATERIALES=load('DATA.dat');

% DEFINIR VARIABLES

ESPESOR1=MATERIALES(1,1);
DENSIDAD1=MATERIALES(1,2);
MODULODEYOUNG1=MATERIALES(1,3);
AMORTIGUAMIENTO1=MATERIALES(1,4);

ESPESOR2=MATERIALES(1,1);
DENSIDAD2=MATERIALES(1,2);
MODULODEYOUNG2=MATERIALES(1,3);
AMORTIGUAMIENTO2=MATERIALES(1,4);


ESPESOR3=MATERIALES(1,1);
DENSIDAD3=MATERIALES(1,2);
MODULODEYOUNG3=MATERIALES(1,3);
AMORTIGUAMIENTO3=MATERIALES(1,4);


ESPESOR4=MATERIALES(1,1);
DENSIDAD4=MATERIALES(1,2);
MODULODEYOUNG4=MATERIALES(1,3);
AMORTIGUAMIENTO4=MATERIALES(1,4);



% SUPERFICIE EXTERIOR PANEL 1
set(handles.edit1,'string',ESPESOR1)
set(handles.edit2,'string',DENSIDAD1)
set(handles.edit3,'string',MODULODEYOUNG1/10^9)
set(handles.edit4,'string',AMORTIGUAMIENTO1)


% SUPERFICIE INTERIOR PANEL 1
set(handles.edit9,'string',ESPESOR2)
set(handles.edit10,'string',DENSIDAD2)
set(handles.edit11,'string',MODULODEYOUNG2/10^9)
set(handles.edit12,'string',AMORTIGUAMIENTO2)


% SUPERFICIE EXTERIOR PANEL 2
set(handles.edit5,'string',ESPESOR3)
set(handles.edit6,'string',DENSIDAD3)
set(handles.edit7,'string',MODULODEYOUNG3/10^9)
set(handles.edit8,'string',AMORTIGUAMIENTO3)


% SUPERFICIE INTERIOR PANEL 2
set(handles.edit13,'string',ESPESOR4)
set(handles.edit14,'string',DENSIDAD4)
set(handles.edit15,'string',MODULODEYOUNG4/10^9)
set(handles.edit16,'string',AMORTIGUAMIENTO4)


M1=DENSIDAD1*(ESPESOR1*10^-3);  % MASA SUPERFICIAL
B1=(MODULODEYOUNG1*(ESPESOR1*10^-3)^3)/12; % Rigidez al Pliegue
M3=DENSIDAD3*(ESPESOR3*10^-3);  % MASA SUPERFICIAL
B3=(MODULODEYOUNG3*(ESPESOR3*10^-3)^3)/12; % Rigidez al Pliegue


RHO=1.18; %Densidad del Aire
C=343;% veelocidad del sonido a 20 C

f=linspace(45,6000,1191);

for aux=1:length(f)

    g=(@(x)((1+(AMORTIGUAMIENTO1.*((2*pi*f(aux)*M1.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*B1.*sin(x).^4)/(M1*C^4)))).^2+(((2*pi*f(aux)*M1.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*B1.*sin(x).^4)/(M1*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
    Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
    t=Q*2.0904; % TAU de Campo
    TL1(aux)=10*log10(1/t);
    stopBar= progressbar(aux/length(f),0);
    if (stopBar) break; end
    
    
end

TL2=TL1;
MT1=M1;
MT2=M3;
BT1=B1;
BT2=B3;
NT1=AMORTIGUAMIENTO1;
NT2=AMORTIGUAMIENTO3;


FCI=((C^2)/(2*pi))*sqrt(MT1/BT1);% Frecuencia Critica
FCII=((C^2)/(2*pi))*sqrt(MT2/BT2);% Frecuencia Critica

% COLOCAR IMAGEN POR DEFECTO

axes(handles.axes3)
background = imread('DE.jpg');
axis off;
imshow(background);


% COLOCAR IMAGEN

axes(handles.axes2)
background = imread('PANEL.jpg');
axis off;
imshow(background);

axes(handles.axes4)
background = imread('PANEL.jpg');
axis off;
imshow(background);


[a]=imread('ayuda.jpg');
[r,c]=size(a);
x=ceil(r/30);
y=ceil(c/100);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.ayuda,'CData',g);



VCHBOX1=0;
NOMBRE1='Placa de Yeso Cartn Estandar';
NOMBRE2='Placa de Yeso Cartn Estandar';
VCHBOX2=0;
NOMBRE3='Placa de Yeso Cartn Estandar';
NOMBRE4='Placa de Yeso Cartn Estandar';


save PANEL1 TL1 MT1 BT1 NT1 FCI
save PANEL2 TL2 MT2 BT2 NT2 FCII








% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = walls_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 selection change in popupmenu3.
function popupmenu3_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu3


% --- Executes during object creation, after setting all properties.
function popupmenu3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu3 (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


% --- Executes on selection change in ME1.
function ME1_Callback(hObject, eventdata, handles)

%CARGAR BASE DE DATOS

MATERIALES=load('DATA.dat');

global ESPESOR1 DENSIDAD1 MODULODEYOUNG1 AMORTIGUAMIENTO1 NOMBRE1;


% OBTENIENDO OPCIONES

val = get(hObject,'Value');

str=get(hObject,'string');
NOMBRE1=str{val};

%DEFINIENDO VALORES

ESPESOR1=MATERIALES(val,1);
DENSIDAD1=MATERIALES(val,2);
MODULODEYOUNG1=MATERIALES(val,3);
AMORTIGUAMIENTO1=MATERIALES(val,4);
 

 % SUPERFICIE EXTERIOR PANEL 1
set(handles.edit1,'string',ESPESOR1)
set(handles.edit2,'string',DENSIDAD1)
set(handles.edit3,'string',MODULODEYOUNG1/10^9)
set(handles.edit4,'string',AMORTIGUAMIENTO1)


      
      
    


% --- Executes during object creation, after setting all properties.
function ME1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ME1 (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


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

% Hints: contents = get(hObject,'String') returns popupmenu4 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu4


% --- Executes during object creation, after setting all properties.
function popupmenu4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (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


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

% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu2


% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (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


% --- Executes on selection change in MI1.
function MI1_Callback(hObject, eventdata, handles)

%CARGAR BASE DE DATOS

MATERIALES=load('DATA.dat');

global ESPESOR2 DENSIDAD2 MODULODEYOUNG2 AMORTIGUAMIENTO2 NOMBRE2;


% OBTENIENDO OPCIONES

val = get(hObject,'Value');

str=get(hObject,'string');
NOMBRE2=str{val};


%DEFINIENDO VALORES

ESPESOR2=MATERIALES(val,1);
DENSIDAD2=MATERIALES(val,2);
MODULODEYOUNG2=MATERIALES(val,3);
AMORTIGUAMIENTO2=MATERIALES(val,4);
 

 % SUPERFICIE EXTERIOR PANEL 1
set(handles.edit9,'string',ESPESOR2)
set(handles.edit10,'string',DENSIDAD2)
set(handles.edit11,'string',MODULODEYOUNG2/10^9)
set(handles.edit12,'string',AMORTIGUAMIENTO2)









% --- Executes during object creation, after setting all properties.
function MI1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to MI1 (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


% --- Executes on selection change in MI2.
function MI2_Callback(hObject, eventdata, handles)

%CARGAR BASE DE DATOS

MATERIALES=load('DATA.dat');

global ESPESOR4 DENSIDAD4 MODULODEYOUNG4 AMORTIGUAMIENTO4 NOMBRE4;


% OBTENIENDO OPCIONES

val = get(hObject,'Value');
str=get(hObject,'string');
NOMBRE4=str{val};


%DEFINIENDO VALORES

ESPESOR4=MATERIALES(val,1);
DENSIDAD4=MATERIALES(val,2);
MODULODEYOUNG4=MATERIALES(val,3);
AMORTIGUAMIENTO4=MATERIALES(val,4);
 

 % SUPERFICIE EXTERIOR PANEL 2
set(handles.edit13,'string',ESPESOR4)
set(handles.edit14,'string',DENSIDAD4)
set(handles.edit15,'string',MODULODEYOUNG4/10^9)
set(handles.edit16,'string',AMORTIGUAMIENTO4)



% --- Executes during object creation, after setting all properties.
function MI2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to MI2 (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


% --- Executes on selection change in ME2.
function ME2_Callback(hObject, eventdata, handles)


%CARGAR BASE DE DATOS

MATERIALES=load('DATA.dat');

global ESPESOR3 DENSIDAD3 MODULODEYOUNG3 AMORTIGUAMIENTO3 NOMBRE3;


% OBTENIENDO OPCIONES

val = get(hObject,'Value');

str=get(hObject,'string');
NOMBRE3=str{val};


%DEFINIENDO VALORES

ESPESOR3=MATERIALES(val,1);
DENSIDAD3=MATERIALES(val,2);
MODULODEYOUNG3=MATERIALES(val,3);
AMORTIGUAMIENTO3=MATERIALES(val,4);
 

 % SUPERFICIE EXTERIOR PANEL 2
set(handles.edit5,'string',ESPESOR3)
set(handles.edit6,'string',DENSIDAD3)
set(handles.edit7,'string',MODULODEYOUNG3/10^9)
set(handles.edit8,'string',AMORTIGUAMIENTO3)









% --- Executes during object creation, after setting all properties.
function ME2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ME2 (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 edit1_Callback(hObject, eventdata, handles)

global ESPESOR1;

espesor1=str2double(get(hObject,'String'));

if isnan(espesor1)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',ESPESOR1);
return
end
if espesor1<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',ESPESOR1);
return
end

ESPESOR1=espesor1;



% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit2_Callback(hObject, eventdata, handles)

global DENSIDAD1;

densidad1=str2double(get(hObject,'String'));

if isnan(densidad1)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',DENSIDAD1);
return
end
if densidad1<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',DENSIDAD1);
return
end

DENSIDAD1=densidad1;

% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit3_Callback(hObject, eventdata, handles)

global MODULODEYOUNG1;

modulodeyoung1=str2double(get(hObject,'String'));

if isnan(modulodeyoung1)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',MODULODEYOUNG1/10^9);
return
end
if modulodeyoung1<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',MODULODEYOUNG1/10^9);
return
end

MODULODEYOUNG1=modulodeyoung1*10^9;

% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit4_Callback(hObject, eventdata, handles)

global AMORTIGUAMIENTO1;

amortiguamiento1=str2double(get(hObject,'String'));

if isnan(amortiguamiento1)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO1);
return
end
if amortiguamiento1<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO1);
return
end

AMORTIGUAMIENTO1=amortiguamiento1;

% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (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 edit9_Callback(hObject, eventdata, handles)
global ESPESOR2;

espesor2=str2double(get(hObject,'String'));

if isnan(espesor2)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',ESPESOR2);
return
end
if espesor2<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',ESPESOR2);
return
end

ESPESOR2=espesor2;

% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit9 (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 edit10_Callback(hObject, eventdata, handles)

global DENSIDAD2;

densidad2=str2double(get(hObject,'String'));

if isnan(densidad2)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',DENSIDAD2);
return
end
if densidad2<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',DENSIDAD2);
return
end

DENSIDAD2=densidad2;

% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit10 (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 edit11_Callback(hObject, eventdata, handles)

global MODULODEYOUNG2;

modulodeyoung2=str2double(get(hObject,'String'));

if isnan(modulodeyoung2)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',MODULODEYOUNG2/10^9);
return
end
if modulodeyoung2<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',MODULODEYOUNG2/10^9);
return
end

MODULODEYOUNG2=modulodeyoung2*10^9;


% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit11 (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 edit12_Callback(hObject, eventdata, handles)
global AMORTIGUAMIENTO2;

amortiguamiento2=str2double(get(hObject,'String'));

if isnan(amortiguamiento2)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO2);
return
end
if amortiguamiento2<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO2);
return
end

AMORTIGUAMIENTO2=amortiguamiento2;


function edit12_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit12 (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 edit13_Callback(hObject, eventdata, handles)

global ESPESOR4;

espesor4=str2double(get(hObject,'String'));

if isnan(espesor4)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',ESPESOR4);
return
end
if espesor4<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',ESPESOR4);
return
end

ESPESOR4=espesor4;


% --- Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit13 (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 edit14_Callback(hObject, eventdata, handles)

global DENSIDAD4;

densidad4=str2double(get(hObject,'String'));

if isnan(densidad4)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',DENSIDAD4);
return
end
if densidad4<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',DENSIDAD4);
return
end

DENSIDAD4=densidad4;


% --- Executes during object creation, after setting all properties.
function edit14_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit14 (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 edit15_Callback(hObject, eventdata, handles)

global MODULODEYOUNG4;

modulodeyoung4=str2double(get(hObject,'String'));

if isnan(modulodeyoung4)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',MODULODEYOUNG4/10^9);
return
end
if modulodeyoung4<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',MODULODEYOUNG4/10^9);
return
end

MODULODEYOUNG4=modulodeyoung4*10^9;

% --- Executes during object creation, after setting all properties.
function edit15_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit15 (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 edit16_Callback(hObject, eventdata, handles)

global AMORTIGUAMIENTO4;

amortiguamiento4=str2double(get(hObject,'String'));

if isnan(amortiguamiento4)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO4);
return
end
if amortiguamiento4<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO4);
return
end

AMORTIGUAMIENTO4=amortiguamiento4;


% --- Executes during object creation, after setting all properties.
function edit16_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit16 (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 edit5_Callback(hObject, eventdata, handles)

global ESPESOR3;

espesor3=str2double(get(hObject,'String'));

if isnan(espesor3)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',ESPESOR3);
return
end
if espesor3<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',ESPESOR3);
return
end

ESPESOR3=espesor3;

% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit5 (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 edit6_Callback(hObject, eventdata, handles)

global DENSIDAD3;

densidad3=str2double(get(hObject,'String'));

if isnan(densidad3)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',DENSIDAD3);
return
end
if densidad3<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',DENSIDAD3);
return
end

DENSIDAD3=densidad3;


% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (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 edit7_Callback(hObject, eventdata, handles)

global MODULODEYOUNG3;

modulodeyoung3=str2double(get(hObject,'String'));

if isnan(modulodeyoung3)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',MODULODEYOUNG3/10^9);
return
end
if modulodeyoung3<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',MODULODEYOUNG3/10^9);
return
end

MODULODEYOUNG3=modulodeyoung3*10^9;


% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit7 (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 edit8_Callback(hObject, eventdata, handles)

global AMORTIGUAMIENTO3;

amortiguamiento3=str2double(get(hObject,'String'));

if isnan(amortiguamiento3)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO3);
return
end
if amortiguamiento3<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',AMORTIGUAMIENTO3);
return
end

AMORTIGUAMIENTO3=amortiguamiento3;

% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit8 (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 checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox1 (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 checkbox1

global VCHBOX1;

VCHBOX1=get(hObject,'Value');


if (get(hObject,'Value') == get(hObject,'Max'))
   
  
        % SUPERFICIE INTERIOR PANEL 1

        set(handles.MI1,'enable','on')
        set(handles.edit9,'enable','on')
        set(handles.edit10,'enable','on')
        set(handles.edit11,'enable','on')
        set(handles.edit12,'enable','on')

                % COLOCAR IMAGEN
                
                axes(handles.axes2)
                background = imread('PANEL.jpg');
                axis off;
                imshow(background);
                
                 % COLOCAR IMAGEN
                
                axes(handles.axes1)
                background = imread('PANEL.jpg');
                axis off;
                imshow(background);
                
                

else

        % SUPERFICIE INTERIOR PANEL 1

        set(handles.MI1,'enable','off')
        set(handles.edit9,'enable','off')
        set(handles.edit10,'enable','off')
        set(handles.edit11,'enable','off')
        set(handles.edit12,'enable','off')
        
        % COLOCAR IMAGEN
                
          axes(handles.axes2)
          background = imread('PANEL.jpg');
          axis off;
          imshow(background);
        
        
        
        axes(handles.axes1)
        image(background,'visible','off')
        set(handles.axes1,'visible','off')

end







% --- Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)

global VCHBOX2

VCHBOX2=get(hObject,'Value');



if (get(hObject,'Value') == get(hObject,'Max'))
   
  
        % SUPERFICIE INTERIOR PANEL 2

        set(handles.MI2,'enable','on')
        set(handles.edit13,'enable','on')
        set(handles.edit14,'enable','on')
        set(handles.edit15,'enable','on')
        set(handles.edit16,'enable','on')
        
         % COLOCAR IMAGEN
                
                axes(handles.axes4)
                background = imread('PANEL.jpg');
                axis off;
                imshow(background);
                
                 % COLOCAR IMAGEN
                
                axes(handles.axes5)
                background = imread('PANEL.jpg');
                axis off;
                imshow(background);



else

        % SUPERFICIE INTERIOR PANEL 2

        set(handles.MI2,'enable','off')
        set(handles.edit13,'enable','off')
        set(handles.edit14,'enable','off')
        set(handles.edit15,'enable','off')
        set(handles.edit16,'enable','off')
        set(handles.axes5,'visible','off')
        
        
        % COLOCAR IMAGEN
                
          axes(handles.axes4)
          background = imread('PANEL.jpg');
          axis off;
          imshow(background);
        
        
        
        axes(handles.axes5)
        image(background,'visible','off')
        set(handles.axes5,'visible','off')

end










% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)

%BOTON CALCULAR

global ESPESOR1 DENSIDAD1 MODULODEYOUNG1 AMORTIGUAMIENTO1 ESPESOR2 DENSIDAD2 MODULODEYOUNG2 AMORTIGUAMIENTO2 TL1 FC1 FC2 M1 M2; 

RHO=1.18; %Densidad del Aire
C=343;% veelocidad del sonido a 20 C

M2=[];
FC2=[];



f=linspace(45,6000,1191);

if get(handles.checkbox1,'Value')==0
    
%% CALCULO TL1
    
    M1=DENSIDAD1*(ESPESOR1*10^-3);  % MASA SUPERFICIAL
    B1=(MODULODEYOUNG1*(ESPESOR1*10^-3)^3)/12; % Rigidez al Pliegue
    FC1=((C^2)/(2*pi))*sqrt(M1/B1);% Frecuencia Critica
 

    for aux=1:length(f)
    stopBar= progressbar(aux/length(f),0);
    if (stopBar) break; end
    g=(@(x)((1+(AMORTIGUAMIENTO1.*((2*pi*f(aux)*M1.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*B1.*sin(x).^4)/(M1*C^4)))).^2+(((2*pi*f(aux)*M1.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*B1.*sin(x).^4)/(M1*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
    Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
    t=Q*2.0904; % TAU de Campo
    TL1(aux)=10*log10(1/t);
    

   
    end
    
    MT1=M1;
    BT1=B1;
    NT1=AMORTIGUAMIENTO1;
    FCI=FC1;
    save PANEL1 MT1 TL1 BT1 NT1 FCI
    
    
    
end

if get(handles.checkbox1,'Value')==1
%% CALCULO TL1
   
    M1=DENSIDAD1*(ESPESOR1*10^-3);  % MASA SUPERFICIAL
    B1=(MODULODEYOUNG1*(ESPESOR1*10^-3)^3)/12; % Rigidez al Pliegue
    FC1=((C^2)/(2*pi))*sqrt(M1/B1);% Frecuencia Critica
   
    M2=DENSIDAD2*(ESPESOR2*10^-3);
    B2=(MODULODEYOUNG2*(ESPESOR2*10^-3)^3)/12; % Rigidez al Pliegue
    FC2=((C^2)/(2*pi))*sqrt(M2/B2);% Frecuencia Critica
    
    MT=M1+M2;
    BTO=B1+B2;
    NT=AMORTIGUAMIENTO1+AMORTIGUAMIENTO2;
    
    for aux=1:length(f)
    stopBar= progressbar(aux/length(f),0);
    if (stopBar) break; end
    g=(@(x)((1+(NT.*((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*BTO.*sin(x).^4)/(MT*C^4)))).^2+(((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*BTO.*sin(x).^4)/(MT*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
    Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
    t=Q*2.0904; % TAU de Campo
    TL1(aux)=10*log10(1/t);
    

   
    end
    
    MT1=MT;
    BT1=BTO;
    NT1=NT;
    FCI=min(FC1,FC2);
    
    save PANEL1 MT1 TL1 BT1 NT1 FCI
    
    
end
    
    
    
 Panel1;   
    
    
    
    
    
    










% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)

%BOTON CALCULAR

global ESPESOR3 DENSIDAD3 MODULODEYOUNG3 AMORTIGUAMIENTO3 ESPESOR4 DENSIDAD4 MODULODEYOUNG4 AMORTIGUAMIENTO4 TL2 FC3 FC4 M3 M4; 

RHO=1.18; %Densidad del Aire
C=343;% veelocidad del sonido a 20 C

M4=[];
FC4=[];



f=linspace(45,6000,1191);

if get(handles.checkbox2,'Value')==0
    
%% CALCULO TL2
    
    M3=DENSIDAD3*(ESPESOR3*10^-3);  % MASA SUPERFICIAL
    B3=(MODULODEYOUNG3*(ESPESOR3*10^-3)^3)/12; % Rigidez al Pliegue
    FC3=((C^2)/(2*pi))*sqrt(M3/B3);% Frecuencia Critica
 

    for aux=1:length(f)
    stopBar= progressbar(aux/length(f),0);
    if (stopBar) break; end

    g=(@(x)((1+(AMORTIGUAMIENTO3.*((2*pi*f(aux)*M3.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*B3.*sin(x).^4)/(M3*C^4)))).^2+(((2*pi*f(aux)*M3.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*B3.*sin(x).^4)/(M3*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
    Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
    t=Q*2.0904; % TAU de Campo
    TL2(aux)=10*log10(1/t);
    
   
    end
    
    MT2=M3;
    BT2=B3;
    NT2=AMORTIGUAMIENTO3;
    FCII=FC3;
   save PANEL2 MT2 TL2 BT2 NT2 FCII
    
end

if get(handles.checkbox2,'Value')==1
%% CALCULO TL1
   
    M3=DENSIDAD3*(ESPESOR3*10^-3);  % MASA SUPERFICIAL
    B3=(MODULODEYOUNG3*(ESPESOR3*10^-3)^3)/12; % Rigidez al Pliegue
    FC3=((C^2)/(2*pi))*sqrt(M3/B3);% Frecuencia Critica
   
    M4=DENSIDAD4*(ESPESOR4*10^-3);
    B4=(MODULODEYOUNG4*(ESPESOR4*10^-3)^3)/12; % Rigidez al Pliegue
    FC4=((C^2)/(2*pi))*sqrt(M4/B4);% Frecuencia Critica
    
    MTT=M3+M4;
    BTTO=B3+B4;
    NTT=AMORTIGUAMIENTO3+AMORTIGUAMIENTO4;
    
    for aux=1:length(f)
    stopBar= progressbar(aux/length(f),0);
    if (stopBar) break; end
    g=(@(x)((1+(NTT.*((2*pi*f(aux)*MTT.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*BTTO.*sin(x).^4)/(MTT*C^4)))).^2+(((2*pi*f(aux)*MTT.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*BTTO.*sin(x).^4)/(MTT*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
    Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
    t=Q*2.0904; % TAU de Campo
    TL2(aux)=10*log10(1/t);
    

   
    end
    
    MT2=MTT;
    BT2=BTTO;
    NT2=NTT;
    FCII=min(FC3,FC4);
    save PANEL2 MT2 TL2 BT2 NT2 FCII 
    
    
end
    
    
    
 Panel2;   


% --- Executes on button press in r1.
function r1_Callback(hObject, eventdata, handles)

global r

set(hObject,'value',1);

r=1;

if get(hObject,'Value') == 1
	
   set(handles.r2,'Value',0)
   set(handles.r3,'Value',0)
   set(handles.DF,'enable','off')
    
	
end

% COLOCAR IMAGEN POR DEFECTO

axes(handles.axes3)
background = imread('DE.jpg');
axis off;
imshow(background);





% --- Executes on button press in r2.
function r2_Callback(hObject, eventdata, handles)

global r

set(hObject,'value',1);

r=2;

if get(hObject,'Value') == 1
	
   set(handles.r1,'Value',0)
   set(handles.r3,'Value',0)
    set(handles.DF,'enable','on') 
	
end

% COLOCAR IMAGEN

axes(handles.axes3)
background = imread('ER.jpg');
axis off;
imshow(background);

% --- Executes on button press in r3.
function r3_Callback(hObject, eventdata, handles)

global r

set(hObject,'value',1);

r=3;
if get(hObject,'Value') == 1
	
   set(handles.r1,'Value',0)
   set(handles.r2,'Value',0)
   set(handles.DF,'enable','off')
	
end

% COLOCAR IMAGEN

axes(handles.axes3)
background = imread('Window.jpg');
axis off;
imshow(background);




function CA_Callback(hObject, eventdata, handles)

global CA;

ca=str2double(get(hObject,'String'));

if isnan(ca)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',CA);
return
end
if ca<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',CA);
return
end

CA=ca*10^-3;


% --- Executes during object creation, after setting all properties.
function CA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CA (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 DF_Callback(hObject, eventdata, handles)

global b;

B=str2double(get(hObject,'String'));

if isnan(B)
errordlg('Debes ingresar un valor nmerico', 'Mala Entrada', 'modal')
set(hObject,'string',b);
return
end
if B<=0
errordlg('Debes ingresar un valor positivo', 'Mala entrada', 'modal')
set(hObject,'string',b);
return
end

b=B*10^-3;
% --- Executes during object creation, after setting all properties.
function DF_CreateFcn(hObject, eventdata, handles)
% hObject    handle to DF (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 pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)

global CA b 
load PANEL1 
load PANEL2

f=linspace(45,6000,1191);
RHO=1.18; %Densidad del Aire
C=343;% veelocidad del sonido a 20 C

if get(handles.r1,'value')==1
    
    MT=MT1+MT2;
    BT=BT1+BT2;
    NT=NT1+NT2;
    f0=(1/(2*pi))*sqrt(RHO*(C^2))*sqrt((MT1+MT2)/(MT1*MT2*CA));
    fl=C/(2*pi*CA);
    
     for aux=1:length(f)
     stopBar= progressbar(aux/length(f),0);
     if (stopBar) break; end
        if f(aux)<f0

            g=(@(x)((1+(NT.*((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2+(((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
            Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
            t=Q*2.0904; % TAU de Campo
            TLD(aux)=10*log10(1/t);
           
            

        else if f(aux)>f0 && f(aux)<fl


                % Con Material Absorbente Alta Densidad
                TLD(aux)=TL1(aux)+TL2(aux)+20*log10(f(aux)*CA)-29;

            else if f(aux)>fl


                    TLD(aux)=TL1(aux)+TL2(aux)+6;

                end
            end

        end
        
    
    
    end
    
    
end



if get(handles.r2,'value')==1
 
    MT=MT1+MT2;
    BT=BT1+BT2;
    NT=NT1+NT2;
    MF=[FCI,FCII];
    fc=max(MF);
    f0=(1/(2*pi))*sqrt(RHO*(C^2))*sqrt((MT1+MT2)/(MT1*MT2*CA));
    fl=C/(2*pi*CA);
    
    
      for aux=1:length(f)
        stopBar= progressbar(aux/length(f),0);
        if (stopBar) break; end
       

            g=(@(x)((1+(NT.*((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2+(((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
            Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
            t=Q*2.0904; % TAU de Campo
            TLM=10*log10(1/t);
            TLm(aux)=TLM;
        
        % CALCULO TL LEY MASA MAS DELTA TL
            
        DeltaTL=10*log10(b*fc)+20*log10(MT1/(MT))-18;
        TLDR(aux)=TLM+DeltaTL;
           
            
            if f(aux)>f0 && f(aux)<fl


                % Con Material Absorbente Alta Densidad
                TLB(aux)=TL1(aux)+TL2(aux)+20*log10(f(aux)*CA)-29;

            else if f(aux)>fl


                    TLB(aux)=TL1(aux)+TL2(aux)+6;

                end
            end

        end
        
    
    
    
    
    

    
%% CALCULO FRECUENCIA DE PUENTE

 A=round(TLDR);
 B=round(TLB);


FP=min(intersect(A,B));

E=min(find(B==FP));

F=TLB(E);

for aux=1:length(f)

    if TLB(aux)==F
        Fp=f(aux);
        break
        
    end
      

end
    
%% CALCULO DOBLE PANEL RGIDO

for var=1:length(f)
    
 if f(var)<f0
        
      TLD(var)=TLm(var);
       
            else if f(var)>f0 && f(var)<Fp

             
                % Con Material Absorbente Alta Densidad 
                TLD(var)=TLB(var);
            
               
                
                        else if f(var)>Fp
               
                
                            TLD(var)=TLDR(var);
                
                            end
                 end
    end
    
            
end



end

    
    
    



if get(handles.r3,'value')==1
    
   
    
    MT=MT1+MT2;
    BT=BT1+BT2;
    NT=NT1+NT2;
    FR=(1/(2*pi))*sqrt(RHO*(C^2))*sqrt((MT1+MT2)/(MT1*MT2*CA));
    F1=C/(2*CA);
    

    
    for aux=1:length(f)
        stopBar= progressbar(aux/length(f),0);
        if (stopBar) break; end
        
        if f(aux)<FR
        g=(@(x)((1+(NT.*((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2+(((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
        Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
        t=Q*2.0904; % TAU de Campo
        TLD(aux)=10*log10(1/t);
        stopBar= progressbar(aux/length(f),0);
        if (stopBar) break; end
        
        
        
        else if f(aux)>FR && f(aux)<F1
                
                g=(@(x)((1+(NT.*((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2+(((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
                Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
                t=Q*2.0904; % TAU de Campo
                TLA(aux)=10*log10(1/t);   
                TLB(aux)=TL1(aux)+TL2(aux)-10+10*log10(CA)+3.76+3;
                
                if TLA(aux)>TLB(aux)
                   TLD(aux)=TLA(aux);
                 else
                  TLD(aux)=TLB(aux);
                 end
                
                
        
            else if f(aux)>F1
                    
                g=(@(x)((1+(NT.*((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2+(((2*pi*f(aux)*MT.*cos(x))/(2*RHO*C)).*(1-(((2*pi*f(aux))^2*BT.*sin(x).^4)/(MT*C^4)))).^2).^-1.*cos(x).*sin(x));%Integral de TAU de CAMPO
                Q = quadl(g,0,(4/9)*pi); % Calculo Integral Tau de Campo
                t=Q*2.0904; % TAU de Campo
                TLA(aux)=10*log10(1/t);   
                TLB(aux)=TL1(aux)+TL2(aux)-10+10*log10(CA)+3.76+3;
                
                if TLA(aux)>TLB(aux)
                   TLD(aux)=TLA(aux);
                 else
                  TLD(aux)=TLB(aux);
                 end
                
                end
                
            end
            
        end
        
    end
end
    

        


save PANELDOBLE TLD

PARED;


% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Ayuda_Callback(hObject, eventdata, handles)
% hObject    handle to Ayuda (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Guardar_Callback(hObject, eventdata, handles)
% hObject    handle to Guardar (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Ayudasub_Callback(hObject, eventdata, handles)
% hObject    handle to Ayudasub (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 ayuda.
function ayuda_Callback(hObject, eventdata, handles)

winopen('AYUDAW.hlp');



Contact us at files@mathworks.com