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

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

% Last Modified by GUIDE v2.5 18-Oct-2009 04:51:43

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

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

global TL2 FC3 M3 M4 FC4

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





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


set(handles.tse,'string',round(M3))
set(handles.fcse,'string',round(FC3))

set(handles.tsi,'string',round(M4))
set(handles.fcsi,'string',round(FC4))


[a]=imread('guardar.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.pushbutton1,'CData',g);



%% FILTRO DE TERCIOS DE OCTAVA

BT=[50;63;80;100;125;160;200;250;315;400;500;630;800;1000;1250;1600;2000;2500;3150;4000;5000];

f=linspace(45,6000,1191);
 a=size(BT);
Nmax=(a(1));
for aux=1:Nmax
   fu=BT(aux)/2^(1/6);
   fo=fu*2^(1/3);
   index=find((f<=fo)&(f>fu));
   a=size(index);
   Ndatos=a(2);
   TLterc(aux)=10*log10(sum(10.^(TL2(index)/10))/Ndatos);% Atenuacion en db y por bandas de tercios de Octava 
    
end;


    set(handles.t1,'string',round(TLterc(1))); %50 Hz
    set(handles.t2,'string',round(TLterc(2))); %63 Hz
    set(handles.t3,'string',round(TLterc(3)));  % 80 Hz
    set(handles.t4,'string',round(TLterc(4)));  % 100 Hz
    set(handles.t5,'string',round(TLterc(5))); % 125 Hz
    set(handles.t6,'string',round(TLterc(6)));   %160 Hz
    set(handles.t7,'string',round(TLterc(7)));  % 200HZ
    set(handles.t8,'string',round(TLterc(8))); %250 Hz
    set(handles.t9,'string',round(TLterc(9)));    %315 Hz
    set(handles.t10,'string',round(TLterc(10)));  %400 Hz
    set(handles.t11,'string',round(TLterc(11)));   %500 Hz 
    set(handles.t12,'string',round(TLterc(12)));      % 630 Hz
    set(handles.t13,'string',round(TLterc(13))); %800 Hz
    set(handles.t14,'string',round(TLterc(14))); %1000 Hz
    set(handles.t15,'string',round(TLterc(15))); %1250 Hz
    set(handles.t16,'string',round(TLterc(16)));    % 1600 Hz
    set(handles.t17,'string',round(TLterc(17)));   %2000 Hz
    set(handles.t18,'string',round(TLterc(18)));     %2500 Hz
    set(handles.t19,'string',round(TLterc(19)));    %3150 Hz
    set(handles.t20,'string',round(TLterc(20)));   %4000 Hz
    set(handles.t21,'string',round(TLterc(21)));   %5000 Hz


%% CALCULO RW

TlRw=TLterc(4:19);

ref=[51 54 57 60 63 66 69 70 71 72 73 74 74 74 74 74];

for k=1:52
for var=1:length(ref) 
    
    desv(var)=ref(var)-TlRw(var);
    
    
end
    pos=find(desv>0);
    desviacion=desv(pos);
    suma=sum(desviacion);
    
    if  suma<32
        Rw=ref(8);
        set(handles.trw,'string',Rw);
        break
    else
        ref=ref-1;
    end

end


%% CALCULO TERMINO ADAPTATIVOS


% Calculo C

Cref=[-29 -26 -23 -21 -19 -17 -15 -13 -12 -11 -10 -9 -9 -9 -9 -9];

a=Cref-TlRw;

b=10.^(a/10);

c=sum(b);

xa=-10*log10(c);

C=round(xa-Rw);
set(handles.tc,'string',C);

%Calculo Ctr

Ctrref=[-20 -20 -18 -16 -15 -14 -13 -12 -11 -9 -8 -9 -10 -11 -13 -15];
        
        
a=Ctrref-TlRw;

b=10.^(a/10);

c=sum(b);

xa=-10*log10(c);

Ctr=round(xa-Rw);

set(handles.tctr,'string',Ctr);
 
%% GRAFICO INDICE DE REDUCCIN SONORA

BTRw=[0;0;0;100;125;160;200;250;315;400;500;630;800;1000;1250;1600;2000;2500;3150;0;0];
axes(handles.axes1)
plot(round(TLterc),'r','LineWidth',2)
indicetick=[1 4 11 14 17 21];
set(gca,'xtick',indicetick,'xticklabel',{'50';'100';'500';'1000';'2000';'5000'});
hold on
plot([nan,nan,nan,ref,nan,nan],'b','LineWidth',2)
hold off
xlabel('Frecuencia (Hz)','FontName','Lucida Console','Fontweight','bold');
ylabel({'Indice de Reduccin Sonora(dB)';''},'FontName','Lucida Console','Fontweight','bold');
grid on





handles.TLP2=TLterc;
handles.Rw=Rw;
handles.C=C;
handles.Ctr=Ctr;
handles.BT=BT;












% Update handles structure
guidata(hObject, handles);

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


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

% BOTN GUARDAR

handles=guidata(gcbo);

global VCHBOX2 ESPESOR3 DENSIDAD3 MODULODEYOUNG3 AMORTIGUAMIENTO3 ESPESOR4 DENSIDAD4 MODULODEYOUNG4 AMORTIGUAMIENTO4 NOMBRE3 NOMBRE4


PT=[handles.BT';round(handles.TLP2)];

if VCHBOX2==0

[filename,pathname]=uiputfile({'*.txt'},'Guardar datos como');

% Si se cancela el guardar

if isequal([filename,pathname],[0,0]) 

return

else


archivo=fullfile(pathname,filename);

end



fi = fopen(archivo, 'wt') ;

fprintf(fi,'%s\n\n\n',char('DATOS SUPERFICIE EXTERIOR: '));



fprintf(fi,'%s\n\n',NOMBRE3);
fprintf(fi,'Espesor: %6.2f mm\n',ESPESOR3);
fprintf(fi,'Densidad: %6.2f Kg/m3\n',DENSIDAD3);
fprintf(fi,'Modulo de Young:%6.2f GPa\n',(MODULODEYOUNG3/10^9));
fprintf(fi,'Amortiguamiento: %6.3f mm\n\n\n',AMORTIGUAMIENTO3);

fprintf(fi,'%s\n\n\n',char('PERDIDA DE TRANSMISIN SONORA TL dB PANEL 2: '));
fprintf(fi,'Rw: %.f \n',handles.Rw);
fprintf(fi,'C: %.f \n',handles.C);
fprintf(fi,'Ctr: %.f \n\n\n',handles.Ctr);
fprintf(fi,'%6.f %6.f\n',PT);





fclose(fi);

end


if VCHBOX2==1

[filename,pathname]=uiputfile({'*.txt'},'Guardar datos como');

% Si se cancela el guardar

if isequal([filename,pathname],[0,0]) 

return

else


archivo=fullfile(pathname,filename);

end



fi = fopen(archivo, 'wt') ;

fprintf(fi,'%s\n\n\n',char('DATOS SUPERFICIE EXTERIOR: '));
fprintf(fi,'%s\n\n',NOMBRE3);
fprintf(fi,'Espesor: %6.2f mm\n',ESPESOR3);
fprintf(fi,'Densidad: %6.2f Kg/m3\n',DENSIDAD3);
fprintf(fi,'Modulo de Young:%6.2f GPa\n',(MODULODEYOUNG3/10^9));
fprintf(fi,'Amortiguamiento: %6.3f mm\n\n\n',AMORTIGUAMIENTO3);


fprintf(fi,'%s\n\n\n',char('DATOS SUPERFICIE INTERIOR: '));
fprintf(fi,'%s\n\n',NOMBRE4);
fprintf(fi,'Espesor: %6.2f mm\n',ESPESOR4);
fprintf(fi,'Densidad: %6.2f Kg/m3\n',DENSIDAD4);
fprintf(fi,'Modulo de Young:%6.2f GPa\n',(MODULODEYOUNG4/10^9));
fprintf(fi,'Amortiguamiento: %6.3f mm\n\n\n',AMORTIGUAMIENTO4);

fprintf(fi,'%s\n\n\n',char('PERDIDA DE TRANSMISIN SONORA TL dB PANEL 2: '));
fprintf(fi,'Rw: %.f \n',handles.Rw);
fprintf(fi,'C: %.f \n',handles.C);
fprintf(fi,'Ctr: %.f \n\n\n',handles.Ctr);
fprintf(fi,'%6.f %6.f\n',PT);



fclose(fi);

end

Contact us at files@mathworks.com