




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、30 eginnersCodeforCompressiveSensingAlejandroWeinsteinSeptember2009SparseSignalsintheTimeDomain1.1UsingaRandomSensingMatrixInthisfirstexamplewewillmeasureasignalthatissparseinthetimedomain.Wewillusearandomsensingmatrix,andwewillsolvetherecoveryproblemusingthel1-Magictoolbox.Weusethefollowingfunction
2、stogeneratethesignalsandthesensingmatrix: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);Thefollowingscriptusethesefunctionstogeneratethesignal,takethemeasurementsanddotherec
3、overy.Figure1showstheresult.Listing2:Example1.1234567891011121314151617181920212223242526272829%CSexample1Sensingmatrixphiisrandom.RepresentationbasisPsiistheRecoveringusingl1magic.2;s15*525=nsm%SignallengthSparsitylevelNumberofmeasurementsf=getsparsefun(n,s);A=getArandom(n,m);y=A*f;%Takethemeasurem
4、ents%Solveusingl1magic.path(path,./Optimization);x0=pinv(A)*y;%initialguess=ticxp=l1eqpd(x0,A,y,1e-3);tocnorm(f-xp)/norm(f)plot(f)holdonplot(xp,r.)legend(Original,Recovered)canonicalbasis.minenergy30 #TherecoverycanbemadebyusingCVXinsteadofl1-Magic.Justreplacelines19to24by3 -3.1111ii1I111OriginRecov
5、alered-111111I111|210-1-250100150200250300350400450500Figure1:Script1results.Listing3:UsingCVXfortherecovery.%SolveusingCVX.cvxbeginvariablexp(n);minimize(norm(xp,1);subjecttoA*xp=y;cvxend1.2UsingaFourierSensingMatrixNowwearegoingtorepeatthesameexperiment,butusingasamplingmatrixbasedontheFourierbasi
6、s.Wegeneratethemeasurementmatrixwiththefollowingfunction: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_logbarrierinsteadofl1eq_pd.Ontheothe
7、rhand,thereisnoneedtochangeanythingwhensolvingtheproblemwithCVX.SinceingeneralissimplerandclearertouseCVX,weonlyusethisapproachinthefollowingexamples.SparseSignalintheFrequencyDomainLetstrynowwithasignalsparseinthefrequencydomain.Wegeneratethesignalas:Listing5:Sparsesignalinthefrequencydomain.0:n-1;
8、cos(2*pi/256*t)+cos(2*pi/128*t); 1234567891011Figure2showstheresult.Asexpected,therecoveryisexact.Letsmodifyoursignalslightly,byreplacingoneofthecosinebyasine:LetssolvewitharandomsensingmatrixandCVX.Noticethatnowweneedtospecifytherepresentationbasis(seeline5):Listing6:RandommeasurementsandCVXrecover
9、y.A=getArandom(n,m);y=A*f;%SolveusingCVX.Psi=inv(fft(eye(n);cvxbeginvariablexp(n);minimize(norm(xp,1);subjecttoA*Psi*xp=y;cvxendFigure2:Recoveryofafrequencydomainsparsesignal.Listing7:Sparsesignalinthefrequencydomain.t=0:n-1;f=cos(2*pi/256*t)+sin(2*pi/128*t);Figure3showstheresult.Evidentlythereissom
10、ethingwrong.TheproblemisthatnowtheFouriercoefficientshaveanimaginarycomponent,butCVXissearchingforarealx.Thesolutioniseasy,wejustneedtotellCVXtoconsideracomplexx:Listing8:Sparsesignalinthefrequencydomain.%SolveusingCVX.Psi=inv(fft(eye(n);cvxbeginvariablexp(n)complex;%WeneedtotellCVXthatxpiscomplex!m
11、inimize(norm(xp,1);subjecttoA*Psi*xp=y;cvxendFigure4showstheresult.Nowtherecoveryisexact.Wecanalsotrywithahighersparsitylevel.Thefollowingscriptcreateasignalbyaddingsixsinusoidswithrandomperiod,amplitudeandphases.Noticethattheperiodsarechosenfromthevector163264128256512.Figure5showstheresult.Onceaga
12、in,therecoveryisexact.Listing9:Signalmadeof6randomsinuoids.s=6;amp=rand(s,1);%amplitudesperiods=163264128256512;4tmp=randperm(length(periods);freq=(2*pi./round(periods(tmp(1:s);%frequenciesphases=2*pi*rnd(s,1);f=zeros(n,1);t=0:n-1;fork=1:s,f=f+amp(k)*cos(freq(k)*t+phases(k);endWenowreplacetheperiods
13、weareusingby183264128256512.Noticethattheonlydifferenceisthatnowthesmallestperiodis18insteadof16.Figure6showstheresult.Nowtheresultisnotexact.Thereasonforthisisthatnowthesignalisnotreallysparse,sinceoneoftheperiodsisnotanintegermultipleofthesignallength.AcknowledgmentsThankstoDr.MichaelWakinandBorhanSanandajiforhelpingmetosolvesomeoftheissuesIhadwiththecode.1Ifthesignalissparseinthetimedomain,=Identitymatrix,thatswhywedidntspecifyinsection1.Figure4:SuccessfullyrecoveryaftertellingCVXtouseacomple
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權(quán)】 ISO/TS 23164:2025 EN Automation systems and integration - Core vocabulary for industrial data
- 【正版授權(quán)】 ISO 7434:2024 EN Fasteners - Slotted set screws with cone point
- 2025年度展覽場(chǎng)地租賃合同保證金與押金繳納細(xì)則
- 2025年涼果蜜餞合作協(xié)議書
- 2025年度智慧交通樞紐包工施工合同(智能交通系統(tǒng))
- 2025房地產(chǎn)股權(quán)并購(gòu)項(xiàng)目盡職調(diào)查及服務(wù)合同
- 2025年度智能家居標(biāo)準(zhǔn)私房買賣合同范文
- 增強(qiáng)知識(shí)管理的主管工作計(jì)劃
- 多元化班級(jí)文化的建設(shè)方法計(jì)劃
- 客戶投訴處理流程的總結(jié)與反思計(jì)劃
- 《2024版CSCO胰腺癌診療指南》更新要點(diǎn)
- 兒童福利機(jī)構(gòu)安全管理規(guī)范
- 鞋類制造過程的節(jié)能與減排
- 第1課 おじぎ 課件高中日語(yǔ)人教版第一冊(cè)-1
- ISO∕IEC 23894-2023 信息技術(shù) -人工智能 - 風(fēng)險(xiǎn)管理指南(雷澤佳譯-2024)
- 事前績(jī)效評(píng)估具體工作實(shí)施方案
- 六年級(jí)下冊(cè)語(yǔ)文第一單元測(cè)試卷 部編版(含答案)
- 2024年湖南高速鐵路職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)適應(yīng)性測(cè)試題庫(kù)新版
- 《研學(xué)旅行市場(chǎng)營(yíng)銷》課件-研學(xué)旅行市場(chǎng)營(yíng)銷之社群營(yíng)銷
- 醫(yī)學(xué)人體美學(xué)的測(cè)量和評(píng)估
- 艱難梭菌感染動(dòng)物模型的建立及其應(yīng)用評(píng)價(jià)
評(píng)論
0/150
提交評(píng)論