📄 riskbrowser.m
字号:
% RiskBrowser.m
disp('********************************************************************')
disp('* Exact Risk Analysis in Wavelet Regression *');
disp('********************************************************************')
clear;close all;risk_global;
%RiskBrowserIntro
com = computer;
if strcmp(com,'MAC2'),
special_character = setstr(165);
elseif strcmp(com,'DEC_RISC')
special_character = '*';
elseif strcmp(com,'SUN4');
special_character = setstr(164);
end
back_color = [0.5 0.5 0.5];
global back_color
num_menus = 5;
menu_names = [ ...
'Data______'; ...
'Signals___'; ...
'Settings__'; ...
'Actions___'; ...
'Plots_____'; ...
];
% To add menu items, increase the appropriate number in the array
% below, and add the corresponding 'entries' and 'call backs':
num_menu_items = [ 1 10 0 5 0];
% -- Data for Data menu # 1 --- %
Data_______entries = [ ...
'User Defined' ; ...
];
Data_______callbacks = [ ...
'Gen_data( 0 );' ; ...
];
% -- Data for Signals menu #2 --- %
Signals____entries = [ ...
'Step ' ; ...
'Wave ' ; ...
'Blip ' ; ...
'Blocks ' ; ...
'Bumps ' ; ...
'HeaviSine ' ; ...
'Doppler ' ; ...
'Angles ' ; ...
'Parabolas ' ; ...
'Time Shifted Sine' ; ...
];
Signals____callbacks = [ ...
'Gen_signal( 1);' ; ...
'Gen_signal( 2);' ; ...
'Gen_signal( 3);' ; ...
'Gen_signal( 4);' ; ...
'Gen_signal( 5);' ; ...
'Gen_signal( 6);' ; ...
'Gen_signal( 7);' ; ...
'Gen_signal( 8);' ; ...
'Gen_signal( 9);' ; ...
'Gen_signal(10);' ; ...
];
% -- Data for Settings menu #3 --- %
Settings___entries = [ ...
'Signal Length ' ; ...
'Noise Type ' ; ...
'Noise Level ' ; ...
'Wavelet ' ; ...
'Threshold selector' ; ...
'Plot options ' ; ...
];
Settings___callbacks = [ ...
'define_ ( 1 );'; ...
'define_ ( 2 );'; ...
'define_ ( 3 );'; ...
'define_ ( 4 );'; ...
'define_ ( 5 );'; ...
'define_ ( 6 );'; ...
];
% -- Data for Actions menu #3 --- %
Actions____entries = [ ...
'Add Noise ' ; ...
'Fourier Transform ' ; ...
'Wavelet Transform ' ; ...
'DeNoise/Compress ' ; ...
'Quit ' ; ...
];
Actions____callbacks = [ ...
'take_action(1) '; ...
'take_action(2) '; ...
'take_action(3) '; ...
'take_action(4) '; ...
'take_action(5) '; ...
];
Plots______entries = [ ...
'Wavelet and Fourier Transforms' ; ...
'Power Remaining ' ; ...
'Exact Risk Plots ' ; ...
];
Plots______callbacks = [ ...
'make_plot(1) '; ...
'make_plot(2) '; ...
'make_plot(3) '; ...
];
% Creating the menus
for ii = 1:num_menus
menu_name = menu_names( ii, : );
menu_tag = menu_name;
menu_tags( ii, : ) = [ '*' menu_tag ];
while menu_tag(length(menu_tag)) == '_'
menu_tag(length(menu_tag)) = [];
end
menu_id = uimenu('Label', [ '*' menu_tag ' ' ], ...
'BackgroundColor',back_color,...
'ForegroundColor',[1 0 0 ] );
menu_ids( ii ) = menu_id;
if num_menu_items(ii) > 0,
for kk = 1:num_menu_items( ii )
st = [ 'menu_label = ' menu_name '_entries( kk, : );' ];
eval( st )
st = [ 'callback = ' menu_name '_callbacks( kk, : );' ];
eval( st );
uimenu( menu_id, ...
'Label', menu_label, ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 0 1], ...
'CallBack', callback, ...
'Separator','on' ...
);
end
end
end
% Put in the other submenus now
% Settings menu
h_set = menu_ids(3);
h_len = uimenu(h_set,'Label','Signal Length', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 0 1]);
h_nty = uimenu(h_set,'Label','Noise Type', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 0 1],'Separator','on');
h_nlv = uimenu(h_set,'Label','Noise Level', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 0 1],'Separator','on');
h_wav = uimenu(h_set,'Label','Wavelet', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 0 1],'Separator','on');
h_thr = uimenu(h_set,'Label','Threshold Selector', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 0 1],'Separator','on');
h_plot = uimenu(h_set,'Label','Plot Options', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 0 1],'Separator','on');
% Settings submenus
%
% Signal length submenu
%
global h_lenmenu
h_lenmenu = zeros(6,1);
h_lenmenu(1) = uimenu(h_len,'Label','64',...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_siglen( 64);');
h_lenmenu(2) = uimenu(h_len,'Label','128',...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_siglen( 128);');
h_lenmenu(3) = uimenu(h_len,'Label','256',...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'on', 'CallBack', 'use_siglen( 256);');
h_lenmenu(4) = uimenu(h_len,'Label','512',...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack','use_siglen( 512);');
h_lenmenu(5) = uimenu(h_len,'Label','1024',...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack','use_siglen(1024);');
h_lenmenu(6) = uimenu(h_len,'Label','User Given',...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack','use_siglen(2048);');
%
% Noise Type Submenu
%
global h_ntymenu
h_ntymenu = zeros(4,1);
h_ntymenu(1) = uimenu( h_nty,'Label', 'Gaussian', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'on', 'CallBack', 'use_ntypes(1);');
h_ntymenu(2) = uimenu( h_nty,'Label', 'Uniform', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_ntypes(2);');
h_ntymenu(3) = uimenu( h_nty,'Label', 'Poisson', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_ntypes(3);');
h_ntymenu(4) = uimenu( h_nty,'Label', 'User Given', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_ntypes(4);');
%
% Noise Level Submenu
%
global h_nlvmenu
h_nlvmenu = zeros(3,1);
h_nlvmenu(1) = uimenu( h_nlv, 'Label', 'Low Noise, sigma = 0.02', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'on', 'CallBack', 'use_nlevel(1);');
h_nlvmenu(2) = uimenu( h_nlv, 'Label', 'High Noise, sigma = 0.1', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off' , 'CallBack', 'use_nlevel(2);');
h_nlvmenu(3) = uimenu( h_nlv, 'Label', 'Custom Noise', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_nlevel(3);');
%
% Wavelet Type Submenu
%
global h_wavmenu
h_wavmenu = zeros(4,1);
h_wavmenu(1) = uimenu( h_wav, 'Label', 'Haar', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'on', 'CallBack', 'use_wavelet(1);');
h_wavmenu(2) = uimenu( h_wav, 'Label', 'Daubechies 6', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_wavelet(2);');
h_wavmenu(3) = uimenu( h_wav, 'Label', 'Symmlet 8', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_wavelet(3);');
h_wavmenu(4) = uimenu( h_wav, 'Label', 'Coiflet 3', ...
'BackgroundColor',back_color,...
'ForegroundColor',[0 1 0], ...
'Checked', 'off', 'CallBack', 'use_wavelet(4);');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -