基于GA和MP的信号稀疏分解matlab程序Word格式文档下载.docx
- 文档编号:13063377
- 上传时间:2022-10-04
- 格式:DOCX
- 页数:6
- 大小:9.95KB
基于GA和MP的信号稀疏分解matlab程序Word格式文档下载.docx
《基于GA和MP的信号稀疏分解matlab程序Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《基于GA和MP的信号稀疏分解matlab程序Word格式文档下载.docx(6页珍藏版)》请在冰豆网上搜索。
thescaleisdeterminedbyaandj;
j_min=0;
j_max=log2(N);
u_base=1/2;
%thetransmissionordisplacementushoulddeterminedasfollowingv_base=pi;
%thefrequencyv
k_min=0;
w_base=pi/6;
%thephase wi_min=0;
i_max=12;
%%************************initialization ********************************signal=Im;
signal_reconstruct=zeros(1,N);
signal_r=Im;
%***************wipeoffthedirectcurrentvector*************************
signal_reconstruct=(1/N)*sum(signal);
signal_r=signal-signal_reconstruct;
%*********************startcalculation*********************************forn=1:
iterative_number
%********thefollowingprogramusesonesubroutinetoselectthebestatom**************
[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);
%******reconstructthebestatomfromtheparametersgotbyabovesubroutine*********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));
%normalizatiomtheatom
%***********reconstruct signalandrenewtheresidual**********************signal_reconstruct=signal_reconstruct+proj*g;
signal_r=signal_r-proj*g;
%*************************thefigureofresult************************subplot(221);
plot(signal);
%originalsiganlsubplot(222);
plot(g);
%theatomsubplot(223);
plot(signal_r);
%theresidualsubplot(224);
plot(signal_reconstruct);
%reconstructsignalend
%******************endoffile*************************************function
[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)
%thissubroutineistoselectinthedictionarythebestatomsuitedthesignalortheresidualofthesignal
%thesearchingmethodusedisGeneticAlgorithm(GA).
%thefollowingparametersareusedinGA
% n:
numberofChromosomes
% Ngen:
thenumberofgeneration
% vec:
thesolutionforoneatom
% v
(1):
thescale
% v
(2):
locationortranslation
% v(3):
frequency
% v(4):
phase
%Geneticalgorithm:
INITIALIZATION初始化
%proj_trans:
todeterminewhichprojectionisbiggest
%n:
numberofchromosomes
%Ngen:
%**********************setparrameter***********************************n=21;
Ngen=30;
pool=zeros(4,n);
sig=[1
1
1];
proj_trans=zeros(1,n);
res=ones(1,n);
proj=0;
bi=ones(4,1);
%bi:
lowerboundsbs=ones(4,1);
%bs:
upperbounds
bi
(1)=j_min;
bi
(2)=p_min;
bi(3)=k_min;
bi(4)=i_min;
bs
(1)=j_max;
bs
(2)=N;
bs(3)=N;
bs(4)=i_max;
og=ones(4,n);
%og(i,:
):
vectorofni-genesng=ones(4,n);
%ng:
newgenerationvector
%********************createtheinitialpopulation***************************og(1,:
)=round((bs
(1)-bi
(1))*rand(1,n)+bi
(1));
og(2,:
)=round((bs
(2)-bi
(2))*rand(1,n)+bi
(2));
og(3,:
)=round((bs(3)-bi(3))*rand(1,n)+bi(3));
og(4,:
)=round((bs(4)-bi(4))*rand(1,n)+bi(4));
%******************themainpartof Geneticalgorithm****************forc=1:
Ngen
ford=1:
n
s=a_base^og(1,d);
u=og(2,d);
v=og(3,d)*(1/s)*v_base;
w=og(4,d)*w_base;
t=0:
t=(t-u)/s;
g=(1/sqrt(s))*exp(-pi*t.*t).*cos(v*t+w);
g=g/sqrt(sum(g.*g));
proj_trans(d)=sum(signal_r.*g);
res(d)=abs(proj_trans(d));
end
%********placethebestatom(biggestprojectioninthefirst position)*********
[best,e]=max(res);
ng(:
1)=og(:
e);
og(:
e)=og(:
n);
n)=ng(:
1);
temp_proj=proj_trans(e);
temp_res=res(e);
proj_trans(e)=proj_trans(n);
proj_trans(n)=temp_proj;
res(e)=res(n);
res(n)=temp_res;
%**************competitionbetweentheadjacentatoms***********************ford=2:
2:
n-1
[best,e]=max(res(d-1:
d));
pool(:
d/2)=og(:
d-rem(e,2));
end;
%*****************creationofthepoolforcrossover ********************ford=1:
(n-1)/2
f=ceil((n-1)/2*rand);
Inter=round(rand(4,1));
ng(:
d+1)=pool(:
d).*Inter+pool(:
f).*(1-Inter);
%*****************Mutationsofthewinner *********************sigm=sig(:
ones(n-((n-1)/2+1),1));
ngm=ng(:
ngm=ngm(:
(n-1)/2+2:
n)=round(ngm+(rand(4,n-((n-1)/2+1))-0.5).*sigm);
%*************************boundingintothelimits**********************forl=1:
4
whilemax(ng(l,:
))>
bs(l)
[rw,lw]=max(ng(l,:
));
ng(l,lw)=bs(l);
whilemin(ng(l,:
))<
bi(l)
[rw,lw]=min(ng(l,:
ng(l,lw)=bi(l);
og=ng;
%*******************stable or not?
*********************************nog=og(:
nog=nog(:
ones(1,n));
nog=abs(
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 GA MP 信号 稀疏 分解 matlab 程序
![提示](https://static.bdocx.com/images/bang_tan.gif)