matlab sng,基于GA和MP的信号稀疏分解matlab程序.doc

基于GA和MP的信号稀疏分解matlab程序

基于GA和MP的信号稀疏分解

%% MATLAB script for MP algorithm based on FFT

%

%

%******************** Preparation part *****************************

%

%************************** part 1:imput signal ***************************

Im=wavread('FEM');

Im=Im';

%**************************** part 2: set parameters ***********************

f1=50;

f2=160;

fs=200;

iterative_number=100; % the matching pursuit processing iterative number

[a,N]=size(Im); % the longth of signal and the longth of atoms; N

a_base=2; % scale: the scale is determined by a and j;

j_min=0;

j_max=log2(N);

u_base=1/2; % the transmission or displacement u should determined as following

v_base=pi; % the frequency v

k_min=0;

w_base=pi/6; % the phase w

i_min=0;

i_max=12;

%%************************ initialization ********************************

signal=Im;

signal_reconstruct=zeros(1,N);

signal_r=Im;

%*************** wipe off the direct current vector *************************

signal_reconstruct=(1/N)*sum(signal);

signal_r=signal-signal_reconstruct;

%*********************start calculation*********************************

for n=1:iterative_number

% ********the following program uses one subroutine to select the best atom**************

[proj,scale,translation,freq,phase]=gas(signal_r,N,a_base,j_min,j_max,u_base,p_min,v_base,k_min,w_base,i_min,i_max);

%******reconstruct the best atom from the parameters got by above subroutine*********

t=0:N-1;

t=(t-translation)/scale;

g=(1/sqrt(scale))*exp(-pi*t.*t).*cos(freq*t+phase);

g=g./sqrt(sum(g.*g)); %normalizatiom the atom

%***********reconstruct signal and renew the residual**********************

signal_reconstruct=signal_reconstruct+proj*g;

signal_r=signal_r-proj*g;

%************************* the figure of result ************************

subplot(221);

plot(signal); % original siganl

subplot(222);

plot(g); %the atom

subplot(223);

plot(signal_r); %the residual

subplot(224);

plot(signal_reconstruct); %reconstruct s

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值