📄 compwav.m
字号:
if ChkNoise
NoiseLevel = NoiseLevel*std(signal);
Noise = NoiseLevel*randn(1,lenSIG);
signal = signal + Noise;
titleSTR{2} = [titleSTR{2} ' + N'];
end
if ChkTriangle
L = lenSIG/2;
Triangle = [1:floor(L) , ceil(L):-1:1]/ceil(L);
signal = signal + Triangle;
titleSTR{2} = [titleSTR{2} ' + T'];
end
intervalleSIG = [0,nbFormeBASE*scaleBASE];
stepSIG = (intervalleSIG(2)-intervalleSIG(1))/(lenSIG-1);
xvalSIG = linspace(intervalleSIG(1),intervalleSIG(2),lenSIG);
stepScales = 1;
scales = [scaleMIN:stepScales:scaleMAX];
% Running signal (adapted wavelet column) axes display.
%------------------------------------------------------
lw = 1;
axes(handles.Axe_RunSigAdapWave);
line(xvalSIG,signal,'color','b','linewidth',lw);
Xlim = intervalleSIG;
ext = abs(max(signal) - min(signal)) / 100;
Ylim = [min(signal)-ext max(signal)+ext];
set(handles.Axe_RunSigAdapWave,'Xlim',Xlim,'Ylim',Ylim);
if radVAL,
[Tit1 Tit2] = deal(titleSTR{:});
titleSTR = [Tit1 ': ' Tit2];
end
setAxesTitle(handles.Axe_RunSigAdapWave,titleSTR);
% Set the axes visible.
%----------------------
set(handles.Axe_RunSigAdapWave,'Visible','on');
% Running signal (wavelet column) axes display.
%----------------------------------------------
lw = 1;
axes(handles.Axe_RunSigWave);
line(xvalSIG,signal,'color','b','linewidth',lw);
Xlim = intervalleSIG;
ext = abs(max(signal) - min(signal)) / 100;
Ylim = [min(signal)-ext max(signal)+ext];
set(handles.Axe_RunSigWave,'Xlim',Xlim,'Ylim',Ylim);
setAxesTitle(handles.Axe_RunSigWave,titleSTR);
% Set the axes visible.
%----------------------
set(handles.Axe_RunSigWave,'Visible','on');
% Get the wavelet used.
%----------------------
Wav = cbanapar('get',hFig,'wav');
% Compute the cwt.
%-----------------
C_psi = cwt({signal,stepSIG},scales,PSI);
C_wav = cwt({signal,stepSIG},scales,Wav);
% Find the coordinates of max coefs.
%-----------------------------------
% [ROW_psi,COL_psi] = maxCoefs(C_psi);
% [ROW_wav,COL_wav] = maxCoefs(C_wav);
% Coefficients representation.
%-----------------------------
if RadContours
plotCONTOUR(C_psi,scales,xvalSIG,...
handles.Axe_AdapWaveDetect,handles.Axe_ColBar,'psi',Thresh);
% if ~radVAL, LocalGrid(handles.Axe_AdapWaveDetect,RadTrans); end;
LocalGrid(handles.Axe_AdapWaveDetect,RadTrans,radVAL);
plotCONTOUR(C_wav,scales,xvalSIG,...
handles.Axe_WaveDetect,handles.Axe_ColBar,Wav,Thresh);
% if ~radVAL, LocalGrid(handles.Axe_WaveDetect,RadTrans); end;
LocalGrid(handles.Axe_WaveDetect,RadTrans,radVAL);
set([handles.Fra_ColPar,handles.Txt_PAL,handles.Txt_NBC, ...
handles.Txt_BRI,handles.Pop_PAL,handles.Sli_NBC, ...
handles.Edi_NBC,handles.Pus_BRI_M,handles.Pus_BRI_P],'Enable', 'Off');
elseif RadImages
plotCOEFS(C_psi,scales,xvalSIG,handles,...
handles.Axe_AdapWaveDetect,handles.Axe_ColBar,'psi');
plotCOEFS(C_wav,scales,xvalSIG,handles,...
handles.Axe_WaveDetect,handles.Axe_ColBar,Wav);
set([handles.Fra_ColPar,handles.Txt_PAL,handles.Txt_NBC, ...
handles.Txt_BRI,handles.Pop_PAL,handles.Sli_NBC, ...
handles.Edi_NBC,handles.Pus_BRI_M,handles.Pus_BRI_P],'Enable', 'On');
end
% Set the axes visible.
%----------------------
set(handles.Axe_AdapWaveDetect,'Visible','on');
set(handles.Axe_WaveDetect,'Visible','on');
% Init DynVTool.
%---------------
axe_IND = [];
axe_CMD = [...
handles.Axe_RunSigAdapWave , ...
handles.Axe_RunSigWave , ...
handles.Axe_AdapWaveDetect , ...
handles.Axe_WaveDetect ...
];
axe_ACT = [];
dynvtool('init',hFig,axe_IND,axe_CMD,axe_ACT,[1 0],'','','');
% End waiting.
%-------------
wwaiting('off',hFig);
%--------------------------------------------------------------------------
function Pus_CloseWin_Callback(hObject, eventdata, handles)
% Get nwavetool figure parameters.
%---------------------------------
tool_PARAMS = wtbxappdata('get',hObject,'tool_PARAMS');
% Enable the compare button on in nwavetool figure.
%--------------------------------------------------
set(tool_PARAMS.Pus_Compare,'Enable','On');
% Close current figure.
%----------------------
close(gcbf)
%--------------------------------------------------------------------------
%=========================================================================%
% END Callback Functions %
%=========================================================================%
%=========================================================================%
% BEGIN Special Callback Functions %
% -------------------------------- %
%=========================================================================%
% --- Executes on button press in Compare from nwavtool figure.
function NwavtoolCall_Callback(hObject, eventdata, handles,Nwavetool_PARAMS)
% Save nwavtool information in 'Userdata' field of compwav figure.
%-----------------------------------------------------------------
if isfield(Nwavetool_PARAMS,'demoMODE')
F1 = allchild(0);
end
compwav('userdata',Nwavetool_PARAMS);
if isfield(Nwavetool_PARAMS,'demoMODE')
F2 = allchild(0);
hFig = setdiff(F2,F1);
set(hFig,'HandleVisibility','On')
end
%=========================================================================%
% END Special Callback Functions %
%=========================================================================%
%=========================================================================%
% BEGIN Tool Initialization %
% ------------------------- %
%=========================================================================%
function Init_Tool(hObject,eventdata,handles)
% Begin initialization.
%----------------------
set(hObject,'Visible','off');
% WTBX -- Install DynVTool.
%--------------------------
dynvtool('Install_V3',hObject,handles);
% WTBX -- Install MENUS.
%-----------------------
wfigmngr('extfig',hObject,'ExtFig_GUIDE');
wfigmngr('attach_close',hObject);
set(hObject,'HandleVisibility','On');
hdl_Menus = Install_MENUS(hObject);
% WTBX -- Install ANAPAR FRAME.
%------------------------------
wnameDEF = 'db1';
utanapar('Install_V3_CB',hObject,'wtype','cwt');
cbanapar('set',hObject,'wav',wnameDEF);
% WTBX -- Install COLORMAP FRAME
%-------------------------------
utcolmap('Install_V3',hObject,'enable','On');
default_nbcolors = 240;
cbcolmap('set',hObject,'pal',{'jet',default_nbcolors});
% Get nwavetool figure parameters.
%---------------------------------
Nwavetool_PARAMS = get(hObject,'Userdata');
% Initialize uicontrols.
%-----------------------
set(handles.Rad_Trans,'Value',Nwavetool_PARAMS.RadTrans);
set(handles.Rad_Super,'Value',Nwavetool_PARAMS.RadSuper);
set(handles.Chk_Noise,'Value',Nwavetool_PARAMS.ChkNoise);
set(handles.Chk_Triangle,'Value',Nwavetool_PARAMS.ChkTriangle);
set(Nwavetool_PARAMS.Pus_Compare,'Enable','Off');
% Set current tool figure parameters.
%------------------------------------
tool_PARAMS.X = Nwavetool_PARAMS.X;
tool_PARAMS.Y = Nwavetool_PARAMS.Y;
tool_PARAMS.PSI = Nwavetool_PARAMS.PSI;
tool_PARAMS.NC_PSI = Nwavetool_PARAMS.NC_PSI;
tool_PARAMS.Pus_Compare = Nwavetool_PARAMS.Pus_Compare;
wtbxappdata('set',hObject,'tool_PARAMS',tool_PARAMS);
% Set Title in the RunSigAdapWave axes.
%--------------------------------------
titleSTR = 'Running Signal';
setAxesTitle(handles.Axe_RunSigAdapWave,titleSTR);
% Set Title in the RunSigWave axes.
%----------------------------------
titleSTR = 'Running Signal';
setAxesTitle(handles.Axe_RunSigWave,titleSTR);
% Set Title in the AdapWaveDetect signal axes.
%---------------------------------------------
titleSTR = 'Adapted Wavelet';
setAxesTitle(handles.Axe_AdapWaveDetect,titleSTR);
% Set Title in the pattern detection axes.
%-----------------------------------------
titleSTR = 'Wavelet';
setAxesTitle(handles.Axe_WaveDetect,titleSTR);
% Initialize colorbar.
%---------------------
cmap = get(hObject,'Colormap');
axes(handles.Axe_ColBar);
image([1:size(cmap,1)])
set(handles.Axe_ColBar,...
'Xtick',[],'Xticklabel',[],'Ytick',[],'Yticklabel',[] ...
);
dynvzaxe('exclude',hObject,handles.Axe_ColBar)
ColorBarVisibility(handles.Axe_ColBar,'Off');
% Set colors and fontes for the figure.
%---------------------------------------
wfigmngr('set_FigATTRB',hObject,mfilename);
% End Of initialization.
%-----------------------
redimfig('On',hObject);
set(hObject,'HandleVisibility','Callback');
wfigmngr('set_WTBX_Fig_POS',hObject);
compwav('Pus_Run_Callback',hObject,eventdata,handles);
set(hObject,'Visible','On');
ColorBarVisibility(handles.Axe_ColBar,'On');
%=========================================================================%
% END Tool Initialization %
%=========================================================================%
%=========================================================================%
% BEGIN CleanTOOL function %
% ------------------------ %
%=========================================================================%
function cleanTOOL(handles)
hLINES = findobj(handles,'type','line');
delete(hLINES);
hLINES = findobj(handles,'type','patch');
delete(hLINES);
hIMAGES = findobj(handles,'type','Image');
delete(hIMAGES);
%--------------------------------------------------------------------------
function ColorBarVisibility(Axe_ColBar,status)
hIMAGES = findobj(Axe_ColBar,'type','image');
set(Axe_ColBar,'Visible',status);
set(hIMAGES,'Visible',status);
%-------------------------------------------------------------------------
%=========================================================================%
% END CleanTOOL function %
%=========================================================================%
%=========================================================================%
% BEGIN Internal Functions %
% ------------------------ %
%=========================================================================%
function hdl_Menus = Install_MENUS(hFig)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -