压缩感知入门matlab代码.pdf

压缩感知入门matlab代码.pdf

ID:50154963

大小:160.75 KB

页数:6页

时间:2020-03-07

压缩感知入门matlab代码.pdf_第1页
压缩感知入门matlab代码.pdf_第2页
压缩感知入门matlab代码.pdf_第3页
压缩感知入门matlab代码.pdf_第4页
压缩感知入门matlab代码.pdf_第5页
资源描述:

《压缩感知入门matlab代码.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、BeginnersCodeforCompressiveSensingAlejandroWeinsteinSeptember20091SparseSignalsintheTimeDomain1.1UsingaRandomSensingMatrixInthis¯rstexamplewewillmeasureasignalthatissparseinthetimedomain.Wewillusearandomsensingmatrix,andwewillsolvetherecoveryproblemusingthe

2、l1-Magictoolbox.Weusethefollowingfunctionstogeneratethesignalsandthesensingmatrix:Listing1:Sparsesignalandrandommeasurementmatrix.functionf=getsparsefun(n,s)tmp=randperm(n);f=zeros(n,1);f(tmp(1:s))=randn(s,1);functionA=getArandom(n,m)A=sqrt(1/m)¤randn(m,n);

3、Thefollowingscriptusethesefunctionstogeneratethesignal,takethemeasurementsanddotherecovery.Figure1showstheresult.Listing2:Example1.1%CSexample12%Sensingmatrixphiisrandom.3%RepresentationbasisPsiisthecanonicalbasis.4%Recoveringusingl1magic.56clc7clearall8clo

4、seall910n=512;%Signallength11s=25;%Sparsitylevel12m=5¤s;%Numberofmeasurements1314f=getsparsefun(n,s);15A=getArandom(n,m);1617y=A¤f;%Takethemeasurements1819%Solveusingl1magic.20path(path,'./Optimization');21x0=pinv(A)¤y;%initialguess=minenergy22tic23xp=l1eqp

5、d(x0,A,[],y,1e¡3);24toc2526norm(f¡xp)/norm(f)27plot(f)28holdon29plot(xp,'r.')30legend('Original','Recovered')TherecoverycanbemadebyusingCVXinsteadofl1-Magic.Justreplacelines19to24by13OriginalRecovered210−1−2−350100150200250300350400450500Figure1:Script1resu

6、lts.Listing3:UsingCVXfortherecovery.%SolveusingCVX.cvxbeginvariablexp(n);minimize(norm(xp,1));subjecttoA¤xp==y;cvxend1.2UsingaFourierSensingMatrixNowwearegoingtorepeatthesameexperiment,butusingasamplingmatrixbasedontheFourierbasis.Wegeneratethemeasurementma

7、trixwiththefollowingfunction:Listing4:Fourierbasedmeasurementmatrix.functionA=getAfourier(n,m)tmp=randperm(n);phi=inv(fft(eye(n)));A=phi(tmp(1:m/2),:);A=[real(A);imag(A)];Inordertorecoverthesignalusingl1-magic,nowweneedtousethefunctionl1qc_logbarrierinstead

8、ofl1eq_pd.Ontheotherhand,thereisnoneedtochangeanythingwhensolvingtheproblemwithCVX.SinceingeneralissimplerandclearertouseCVX,weonlyusethisapproachinthefollowingexamples.2SparseSignalintheFrequencyDomai

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。