• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-19
  • 语言: Matlab
  • 标签: fast  ICA  

资源简介

用fast ICA进行混叠信号的分离 没有其他的附带文件,只有一个文件就实现了

资源截图

代码片段和文件信息

clc;clear all;close all;
fs=1000;
N=1024;
t=(0:N-1)/fs;
f1=60;
f2=150;
f3=200;
I1=sin(2*pi*f1*t);
I2=cos(2*pi*f2*t);
I3=randn(size(t));
% I3=sin(2*pi*f3*t);
subplot(431)plot(I1)title(‘输入信号1‘)axis([0100-44]);
subplot(432)plot(I2)title(‘输入信号2‘)axis([0100-44]);
subplot(433)plot(I3)title(‘输入信号3‘)axis([0100-44]);

% 将其组成矩阵
S=[I1;I2;I3];                        
Sweight=rand(size(S1));               
MixedS=Sweight*S;     % 将混合矩阵重新排列并输出
subplot(434)plot(MixedS(1:))title(‘混合信号1‘)axis([0100-44]);
subplot(435)plot(MixedS(2:))title(‘混合信号2‘)axis([0100-44]);
subplot(436)plot(MixedS(3:))title(‘混合信号3‘)axis([0100-44]);
MixedS_bak=MixedS;                  
%%%%%%%%%%%%%%%%%%%%%%%%%%  标准化  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MixedS_mean=zeros(31);
for i=1:3
    MixedS_mean(i)=mean(MixedS(i:));
end                                        % 计算MixedS的均值

for i=1:3
    for j=1:size(MixedS2)
        MixedS(ij)=MixedS(ij)-MixedS_mean(i);
    end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%  白化  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MixedS_cov=cov(MixedS‘);                    % cov为求协方差的函数
[ED]=eig(MixedS_cov);                      % 对信号矩阵的协方差函数进行特征值分解
Q=inv(sqrt(D))*(E)‘;                        % Q为白化矩阵
MixedS_white=Q*MixedS;                      % MixedS_white为白化后的信号矩阵
IsI=cov(MixedS_white‘);                     % IsI应为单位阵            

%%%%%%%%%%%%%%%%%%%%%%%% FASTICA算法  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X=MixedS_white;                            % 以下算法将对X进行操作
[

评论

共有 条评论