⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ica.asv

📁 这是盲信号的代码 都已经通过编译了 做这方面的同仁可以参考一下 我觉得蛮惯用的
💻 ASV
📖 第 1 页 / 共 2 页
字号:
function ica()
%盲源分离系统——瞬时混合情况
%
% 图形用户界面
% 
% 本系统包括各种瞬时混合盲源分离算法
%
% 
% 
% 
% 
%
% Fast_ICA算法源码下载地址:
% http://www.cis.hut.fi/projects/ica/fastica/. 
% The Matlab package was programmed by Jarmo Hurri, Hugo Gavert, Jaakko Sarela, and Aapo
% Hyvarinen.
%
%
%   

% copyright: fasticag.m,v 1.4 2004/07/27 11:35:29 jarmo Exp $


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global values

% Handle to this main figure
global hf_FastICA_MAIN;

%算法选择全局变量
global g_ICA_name;
% Check to see if GUI is already running
% Can't have more than one copy - otherwise the global
% variables and handles can get mixed up.
%if ~isempty(hf_FastICA_MAIN)
 % error('FastICA GUI already running!');
%end


% Handles to other controls in this main window
global ht_FastICA_mixedStatus;
global ht_FastICA_dim;
global ht_FastICA_numOfSamp;
global ht_FastICA_newDim;
global ht_FastICA_whiteStatus;
global ht_FastICA_icaStatus;
global hpm_FastICA_approach;
global he_FastICA_numOfIC;
global hpm_FastICA_g;
global hpm_FastICA_stabilization;

% These global variables are used to store all the values
% I used to use the 'UserData' field of components, but
% that got too complex, so I decided to put everything
% in global variables
global ga_name;
global g_FastICA_mixedsig;
global g_FastICA_pca_D;
global g_FastICA_pca_E;
global g_FastICA_white_sig;
global g_FastICA_white_wm;
global g_FastICA_white_dwm;
global g_FastICA_ica_sig;
global g_FastICA_ica_A;
global g_FastICA_ica_W;
global g_FastICA_initGuess;
global g_FastICA_approach;
global g_FastICA_numOfIC;
global g_FastICA_g;
global g_FastICA_finetune;
global g_FastICA_a1;
global g_FastICA_a2;
global g_FastICA_myy;
global g_FastICA_stabilization;
global g_FastICA_epsilon;
global g_FastICA_maxNumIte;
global g_FastICA_maxFinetune;
global g_FastICA_sampleSize;
global g_FastICA_initState;
global g_FastICA_displayMo;
global g_FastICA_displayIn;
global g_FastICA_verbose;

% initial values for them:
% All the initial values are set here - even for
% variables that are not used in this file

if nargin < 2
  g_FastICA_initGuess = 1;
  % The user didn't enter initial guess so we default
  % back to random initial state.
  g_FastICA_initState = 1;  % see below for string values
else
  g_FastICA_initGuess = InitialGuess;
  % If initial guess was entered, then the user probably
  % wan't to use it, eh?
  g_FastICA_initState = 2;  % see below for string values
end

if nargin < 1
  g_FastICA_mixedsig = [];
else
  g_FastICA_mixedsig = mixedsig; % We'll remove mean
end                              % the first time we
                                 % use this.

% Global variable for stopping the ICA calculations
global g_FastICA_interrupt;

g_FastICA_pca_D = [];
g_FastICA_pca_E = [];
g_FastICA_white_sig = [];
g_FastICA_white_wm = [];
g_FastICA_white_dwm = [];
g_FastICA_ica_sig = [];
g_FastICA_ica_A = [];
g_FastICA_ica_W = [];
g_FastICA_approach = 1;   % see below for string values
g_FastICA_numOfIC = 0;
g_FastICA_g = 1;          % see below for string values
g_FastICA_finetune = 5;   % see below for string values
g_FastICA_a1 = 1;
g_FastICA_a2 = 1;
g_FastICA_myy = 1;
g_FastICA_stabilization = 2; % see below for string values
g_FastICA_epsilon = 0.0001;
g_FastICA_maxNumIte = 1000;
g_FastICA_maxFinetune = 100;
g_FastICA_sampleSize = 1;
g_FastICA_displayMo = 1;  % see below for string values
g_FastICA_displayIn = 1;
g_FastICA_verbose = 1;    % see below for string values

% These are regarded as constants and are used to store
% the strings for the popup menus the current value is
% seen in the variables above
% D - refers to strings that are displayed
% V - refers to string values that are used in FPICA
global c_FastICA_appr_strD;
global c_FastICA_appr_strV;
global c_FastICA_g1_strD;
global c_FastICA_g1_strV;
global c_FastICA_g2_strD;
global c_FastICA_g2_strV;
global c_FastICA_finetune_strD;
global c_FastICA_finetune_strV;
global c_FastICA_stabili_strD;
global c_FastICA_stabili_strV;
global c_FastICA_iSta_strD;
global c_FastICA_iSta_strV;
global c_FastICA_dMod_strD;
global c_FastICA_dMod_strV;
global c_FastICA_verb_strD;
global c_FastICA_verb_strV;



% All the values for these are set here - even for
% variables that are not used in this file

c_FastICA_appr_strD = 'deflation|symmetric';
c_FastICA_appr_strV = ['defl';'symm'];
% The 'g1' and 'g2' below correspond to the values of approach (1 or 2)
% Deflation and Symmetric used to have a bit different selection
% of available nonlinearities.
c_FastICA_g1_strD = 'pow3|tanh|gauss|skew';
c_FastICA_g1_strV = ['pow3';'tanh';'gaus';'skew'];
c_FastICA_g2_strD = 'pow3|tanh|gauss|skew';
c_FastICA_g2_strV = ['pow3';'tanh';'gaus';'skew'];
c_FastICA_finetune_strD = 'pow3|tanh|gauss|skew|off';
c_FastICA_finetune_strV = ['pow3';'tanh';'gaus';'skew';'off '];
c_FastICA_stabili_strD = 'on|off';
c_FastICA_stabili_strV = ['on ';'off'];
c_FastICA_iSta_strD = 'random|guess';
c_FastICA_iSta_strV = ['rand ';'guess'];
c_FastICA_dMod_strD = 'signals|basis|filters|off';
c_FastICA_dMod_strV = ['signals';'basis  ';'filters';'off    '];
c_FastICA_verb_strD = 'on|off';
c_FastICA_verb_strV = ['on ';'off'];

g_ICA_name = '';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Configuration options
FIGURENAME = '盲源分离系统';
FIGURETAG = 'f_FastICA';
SCREENSIZE = get(0,'ScreenSize');
FIGURESIZE = [round(0.1*SCREENSIZE(3)) (SCREENSIZE(4)-round(0.1*SCREENSIZE(4))-370) 530 370];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create the figure
a = figure('Color',[0.8 0.8 0.8], ...
	   'PaperType','a4letter', ...
	   'Name', FIGURENAME, ...
	   'NumberTitle', 'off', ...
	   'Tag', FIGURETAG, ...
	   'Position', FIGURESIZE, ...
	   'MenuBar', 'none');
% Resizing has to be denied after the window has been created -
% otherwise the window shows only as a tiny window in Windows XP.
set (a, 'Resize', 'off');

hf_FastICA_MAIN = a;

set(hf_FastICA_MAIN, 'HandleVisibility', 'callback');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% From here on it get's ugly as I have not had time to clean it up


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create the frames
pos_l=2;
pos_w=FIGURESIZE(3)-4;
pos_h=FIGURESIZE(4)-4;
pos_t=FIGURESIZE(4)-2-pos_h;
h_f_background = uicontrol('Parent',a, ...
  'BackgroundColor',[0.701961 0.701961 0.701961], ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'Style','frame', ...
  'Tag','f_background');

pos_l=4;
pos_w=400;
pos_h=106;
pos_t=FIGURESIZE(4)-4-pos_h;
h_f_mixed = uicontrol('Parent',a, ...
  'BackgroundColor',[0.701961 0.701961 0.701961], ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'Style','frame', ...
  'Tag','f_mixed');

pos_h=90;
pos_t=FIGURESIZE(4)-(106+4+2)-pos_h;
h_f_white = uicontrol('Parent',a, ...
  'BackgroundColor',[0.701961 0.701961 0.701961], ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'Style','frame', ...
  'Tag','f_white');

pos_h=pos_t - 4 - 2;
pos_t=4;
h_f_ica = uicontrol('Parent',a, ...
  'BackgroundColor',[0.701961 0.701961 0.701961], ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'Style','frame', ...
  'Tag','f_ica');

pos_w=120;
pos_l=FIGURESIZE(3)-(pos_w+2+2);
pos_h=FIGURESIZE(4)-2*4;
pos_t=FIGURESIZE(4)-(4)-pos_h;
h_f_side = uicontrol('Parent',a, ...
  'BackgroundColor',[0.5 0.8 0.5], ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'Style','frame', ...
  'Tag','f_side');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Controls in f_mixed
bgc = get(h_f_mixed, 'BackgroundColor');

pos_vspace = 6;
pos_hspace = 6;

pos_frame=get(h_f_mixed, 'Position');
pos_l = pos_frame(1) + 15;
pos_h = 16;
pos_t = pos_frame(2) + pos_frame(4) - pos_h - 6;
pos_w = 100;
b = uicontrol('Parent',a, ...
  'BackgroundColor',bgc, ...
  'HorizontalAlignment','left', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','混合信号:', ...
  'Style','text', ...
  'FontSize',10,...
  'Tag','t_mixed');

pos_l = pos_l + pos_w;
pos_w = 100;
ht_FastICA_mixedStatus = uicontrol('Parent',a, ...
  'BackgroundColor',bgc, ...
  'HorizontalAlignment','left', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','请加载信号', ...
  'FontSize',10,...
  'Style','text', ...
  'Tag','t_mixedstatus');

% V鋒鋘 v鋖i?pos_t = pos_t - 8;

pos_l = pos_frame(1) + 15;
pos_t = pos_t - pos_h-3;
pos_w = 100;
b = uicontrol('Parent',a, ...
  'BackgroundColor',bgc, ...
  'HorizontalAlignment','left', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','信号个数:', ...
  'FontSize',10,...
  'Style','text', ...
  'Tag','t_2');

pos_l = pos_l + pos_w;
pos_w = 50;
ht_FastICA_dim = uicontrol('Parent',a, ...
  'BackgroundColor',bgc, ...
  'HorizontalAlignment','left', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','0', ...
  'Style','text', ...
  'Tag','t_dim');

pos_l = pos_frame(1) + 15;
pos_t = pos_t - pos_h-5;
pos_w = 100;
b = uicontrol('Parent',a, ...
  'BackgroundColor',bgc, ...
  'HorizontalAlignment','left', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','采样点数:', ...
  'Style','text', ...
  'FontSize',10,...
  'Tag','t_3');

pos_l = pos_l + pos_w;
pos_w = 50;
ht_FastICA_numOfSamp = uicontrol('Parent',a, ...
  'BackgroundColor',bgc, ...
  'HorizontalAlignment','left', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','0', ...
  'Style','text', ...
  'Tag','t_numOfSamp');


% Buttons
pos_l = pos_frame(1) + pos_hspace;
pos_w = 110;
pos_h = 30;
pos_t = pos_frame(2) + pos_vspace;
b = uicontrol('Parent',a, ...
  'BackgroundColor',[0.701961 0.701961 0.701961], ...
  'Callback','gui_cb Transpose', ...
  'Interruptible', 'off', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','转 置', ...
  'FontSize',12,...
  'Tag','b_Transpose');

pos_w = 130;
pos_l = pos_frame(1) + pos_frame(3) - pos_hspace - pos_w;
b = uicontrol('Parent',a, ...
  'BackgroundColor',[0.701961 0.701961 0.701961], ...
  'Callback','gui_cb ShowMixed', ...
  'Interruptible', 'off', ...
  'Position',[pos_l pos_t pos_w pos_h], ...
  'String','混合信号波形', ...
  'FontSize',12,...
  'Tag','b_ShowMixed');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Controls in f_white
pos_frame=get(h_f_white, 'Position');
pos_l = pos_frame(1) + 150;
pos_h = 20;
pos_t = pos_frame(2) + pos_frame(4) - pos_h - 10;
pos_w = 150;
b = uicontrol('Parent',a, ...
  'BackgroundColor',bgc, ...
  'HorizontalAlignment','left', ...
  'Position',[pos_l pos_t pos_w pos_h], ...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -