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

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

% Last Modified by GUIDE v2.5 25-Oct-2009 05:08:40

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

clc;
clear global;



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

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

global H N hh dd L Q t rho Po Fe Rf v r1 r2 ES deltap



%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)]);


% COLOCAR IMAGEN POR DEFECTO

axes(handles.axes1)
background = imread('splitter2.jpg');
axis off;
imshow(background);

% COLOCAR IMAGEN POR DEFECTO

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

% COLOCAR IMAGEN POR DEFECTO

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

% COLOCAR IMAGEN POR DEFECTO

axes(handles.axes5)
background = imread('ECirc.jpg');
axis off;
imshow(background);


% COLOCAR IMAGEN POR DEFECTO

axes(handles.axes6)
background = imread('RS.jpg');
axis off;
imshow(background);

% COLOCAR IMAGEN POR DEFECTO

axes(handles.axes7)
background = imread('SC.jpg');
axis off;
imshow(background);


% DATOS POR DEFECTO

%DUCTO

H=0.3; % Altura Silenciador
set(handles.edit2,'string',H)
N=1; % Numero de canales de paso de aire;
set(handles.edit1,'string',N)

% Baffle
hh=0.05;%  Ancho Paso de Aire   m
set(handles.edit3,'string',hh)
dd=0.2; %% Espesor del Baffle m
set(handles.edit4,'string',dd)
L=0.5; % Longitud del Baffle m
set(handles.edit5,'string',L)

% MEDIO

Q=0;%  Ancho Paso de Aire   m
set(handles.edit6,'string',Q)
t=20; %% Espesor del Baffle m
set(handles.edit7,'string',t)
rho=1.18; % Longitud del Baffle m
set(handles.edit8,'string',rho)

% Calculo Velocidad de Flujo m/s

v=(Q/3600)/(N*hh*H);
set(handles.text18,'string',v)


% MATERIAL ABSORBENTE

set(handles.text22,'string',(dd/2))

Po=0.95;% POROSIDAD
set(handles.edit11,'string',Po)
Fe=1; % Factor de Estructura
set(handles.edit10,'string',Fe)
Rf=12500; % Resistencia al flujo por unidad de espesor
set(handles.edit12,'string',Rf)


 set(handles.r1,'Value',1)
 set(handles.r3,'Value',1)

r1=1;
r2=3;

G1=1;
G2=1;


Gf=0.025*(L/hh)*(1+(dd/hh))^2;

Gs=((hh/dd)^2)*(0.5*G1*((hh/dd)+1)+G2);

G=Gf+Gs;

deltap=(1/2)*(rho*v^2)*G;

set(handles.text30,'string',sprintf('%.2f',deltap))


ES=1;









% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = splitter_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 edit1_Callback(hObject, eventdata, handles)

global N hh H Q v

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

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

N=n;

v=(Q/3600)/(N*hh*H);
set(handles.text18,'string',sprintf('%.2f',v))

% --- 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 H hh N Q v 

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

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

H=h;

v=(Q/3600)/(N*hh*H);
set(handles.text18,'string',sprintf('%.2f',v))




% --- 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 hh N H Q v 

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

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

hh=HH;


v=(Q/3600)/(N*hh*H);
set(handles.text18,'string',sprintf('%.2f',v))







% --- 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 dd

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

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

dd=DD;




% --- 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 edit5_Callback(hObject, eventdata, handles)

global L

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

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

L=l;



% --- 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 Q N hh H v

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

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

Q=q;

v=(Q/3600)/(N*hh*H);
set(handles.text18,'string',sprintf('%.2f',v))

% --- 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 t

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

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

t=T;




% --- 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 rho

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

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

rho=RHO;




% --- 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



function edit10_Callback(hObject, eventdata, handles)


global Fe

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

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

Fe=FE;








% --- 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 Po

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

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

Po=PO;

% --- 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 Rf

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

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

Rf=RF;



% --- Executes during object creation, after setting all properties.
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


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

global r2

set(hObject,'value',1);

r2=3;

if get(hObject,'Value') == 1
	
  
   set(handles.r4,'Value',0)

   
end












% --- Executes on button press in r4.
function r4_Callback(hObject, eventdata, handles)

global r2

set(hObject,'value',1);

r2=4;

if get(hObject,'Value') == 1
	
   
   set(handles.r3,'Value',0)

   
end




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

global r1

set(hObject,'value',1);

r1=1;

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







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

global r1

set(hObject,'value',1);

r1=2;

if get(hObject,'Value') == 1
	
   set(handles.r1,'Value',0)
   

   
end




% --- Executes on button press in PL.
function PL_Callback(hObject, eventdata, handles)

global hh dd L v rho r1 r2 deltap ES

% AMBOS RECTANGULOS
if r1==1 && r2==3 
    
    G1=1;
    G2=1;
    
    ES=1;
    
end

% AMBOS CIRCULARES
if r1==2 && r2==4 
    
    G1=0.1;
    G2=0.7;
    
    ES=2;
    
end

%  RECTANGULO CIRCULAR
if r1==1 && r2==4 
    
    G1=1;
    G2=0.7;
    
    ES=3;
    
end

% CIRCULAR RECTANGULO
if r1==2 && r2==3
    
    G1=0.7;
    G2=1;
    
    ES=4;
    
end 


Gf=0.025*(L/hh)*(1+(dd/hh))^2;

Gs=((hh/dd)^2)*(0.5*G1*((hh/dd)+1)+G2);

G=Gf+Gs;

deltap=(1/2)*(rho*v^2)*G;

set(handles.text30,'string',sprintf('%.2f',deltap))





% --- Executes on button press in TL.
function TL_Callback(hObject, eventdata, handles)

global N hh dd H Q L t rho Po Fe Rf v r1 r2 deltap ES

%% Calculos Iniciales

c=331*sqrt((t+273)/273);% Velocidad del Sonido en Funcin de la Temperatura
v=(Q/3600)/(N*hh*H);
set(handles.text18,'string',sprintf('%.2f',v))
set(handles.text22,'string',(dd/2))
d=dd/2; % Mitad del Espesor del Splitter
h=hh/2;% Mitad del Ancho del Paso Libre
Mach=v/c;


%% Calculo Impedancia Porosa, del Nmero de Onda Kx y  de la Atenuacin/longitud de un Conducto o Canal


f=linspace(50,8000,796);

for aux=1:length(f)

w=2*pi*f(aux);
k=w/c;
Zpor=-j*rho*c*(sqrt(Fe)/Po)*sqrt(1-((j*Rf*Po)/(w*rho*Fe)))*cot(k*sqrt(Fe)*sqrt(1-((j*Rf*Po)/(w*rho*Fe)))*d);


[kx,ky]=kaes(f(aux),h,Zpor,3,1000,0.000001,rho,c);




Dh(aux)=-8.68*(imag(kx(1)*h));

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

end

Dh=Dh;
TL=Dh*(L/h);

% INFLUENCIA DEL FLUJO

f=f*(1+Mach);%correccion aprox por flujo.


%% CADA DE PRESIN


% AMBOS RECTANGULOS
if r1==1 && r2==3 
    
    G1=1;
    G2=1;
    
    ES=1;
    
end

% AMBOS CIRCULARES
if r1==2 && r2==4 
    
    G1=0.1;
    G2=0.7;
    
    ES=2;
    
end

%  RECTANGULO CIRCULAR
if r1==1 && r2==4 
    
    G1=1;
    G2=0.7;
    
    ES=3;
    
end

% CIRCULAR RECTANGULO
if r1==2 && r2==3
    
    G1=0.7;
    G2=1;
    
    ES=4;
    
end 


Gf=0.025*(L/hh)*(1+(dd/hh))^2;

Gs=((hh/dd)^2)*(0.5*G1*((hh/dd)+1)+G2);

G=Gf+Gs;

deltap=(1/2)*(rho*v^2)*G;

set(handles.text30,'string',sprintf('%.2f',deltap))



save SP f TL 

Grafico

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


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


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


% --- 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 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)

winopen('AYUDASP.hlp')

Contact us at files@mathworks.com