声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1648|回复: 8

[小波] Gabor变换重构的严重问题

[复制链接]
发表于 2007-11-30 03:10 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
对数据进行Gabor变换,用反变换进行重构,发现结果与原信号相差甚远

Gabor正变换用的是时频工具箱里的tfrgabor程序,反变换程序是我自己编的

比如

y=log(load('data1.m')) %读数据

[ytfr,dgr,gam]=tfrgabor(y); %正变换

[m,n]=size(ytfr);

%反变换
y1=zeros(1,length(y));

for k=1:length(y1)
    a=0;
for i=1:m
    for j=1:n
        a=ytfr(i,j)*(1/(2*sqrt(pi)*(2*m+2)))*exp(-(((k-i*length(y)/m))^2)/((2*m+2)^2))*exp(sqrt(-1)*2*pi*j*k/n)+a;   
    end
end
y1(k)=a;
end

figure(10)
plot((y1))

[ 本帖最后由 JulianChin 于 2007-11-30 03:15 编辑 ]
回复
分享到:

使用道具 举报

 楼主| 发表于 2007-11-30 03:11 | 显示全部楼层
结果是……

[ 本帖最后由 JulianChin 于 2007-11-30 03:14 编辑 ]
原信号.JPG
Gabor分布.JPG
重构后.JPG
 楼主| 发表于 2007-11-30 03:19 | 显示全部楼层

data1.m全体数据

0.006648573485019        0.006245822249335        0.005843024842998        0.005440091721589
0.005036892764129        0.004633260071229        0.004228990765071        0.003823849792423
0.003417572732058        0.00300986860824        0.002600422712089        0.002188899432857        0.001774945101308        0.001358190847513        0.00093825547553        0.000514748357542        0.000087272350068        -0.000344573265009        -0.00078118981187        -0.001222976221827        -0.001670326001267        -0.002123624163685        -0.002583244123089        -0.003049544546098        -0.003522866160132        -0.004003528515223        -0.004491826697052        -0.004988027989027        -0.005492368481309        -0.006005049624978        -0.006526234729671        -0.007056045403292        -0.007594557932667        -0.00814179960431        -0.008697744964744        -0.009262312020221        -0.009835358375988        -0.010416677315682        -0.011005993821837        -0.011602960538951        -0.01220715368101        -0.012818068885883        -0.01343511701954        -0.014057619933582        -0.014684806180187        -0.042261669159764        -0.015949650412528        -0.020934962761439        -0.028787128837749        -0.016694154207199        -0.027527159498321        -0.012032782786276        0.010962916916861        0.005697625760712        0.025101415449036        0.019657539179578        0.031382182020121        0.026368057853472        0.027898592478191        0.027477744924604        0.028901808066964        0.02532925444001        0.005999520012357        -0.000137053196484        0.013741496757913        0.012435602696573        0.008775842482736        0.008091336390792        0.00777873892512        0.003916826744558        -0.005749320476815        -0.005655690316632        -0.005450911419182        -0.014608346856584        -0.011527933910994        -0.00845229964172        0.004416160486922        -0.001830022790241        0.011806600397159        0.010046845271062        -0.000051996412167        0.004778190953679        0.00002713682288        -0.014960598309593        -0.004110233924365        0.001488625237092        -0.016067317765474        0.001858595283351        0.010992332575261        0.016615070364082        0.015060962272599        0.011655245922896        0.011756592735813        0.004192771665281        0.003043822153685        0.003495760404613        -0.001458302791374        0.0103235904531        0.010562701956836        0.011784593666117        0.01085310140627        0.004906156992336        0.006497223815801        -0.001389168089716        0.00064875546293        0.003206140333899        -0.005597202141135        0.006742806472348        0.006908965356359        -0.001188227986202        -0.000404326432347        0.000647417280876        0.002387801417905        -0.006716616912044        -0.005356406266366        -0.002015745812866        -0.010175354397471        -0.007890007816191        0.529302555487139        -0.008394429257994        -0.017938991501476        -0.020256030784174        -0.025266341552228        -0.017486874698439        -0.018910402649587        -0.018307912564129        -0.017118687190009        -0.018979681991184        -0.018915470556166        -0.026987086723595        -0.028428445301818        -0.026117430087749        -0.028732033677165        -0.019636628305237        -0.012357677182052        -0.012273823819381        -0.01234221290971        -0.010995756847862        -0.026963368716241        -0.032338448902514        -0.03764185484765        -0.037557698964084        -0.040394381280882        -0.046257025759809        -0.024906692037817        -0.026838802604856        -0.026819987379137        -0.033251586918264        -0.030146641010887        -0.044916911284163        -0.034891394650881        -0.022879563710343        -0.019766284343688        -0.024822828732064        0.010984377733708        0.015509562690196        0.016968296741071        0.016334412363346        0.009105846232299        0.001908417520507        0.005532936818181        0.012981265603987        0.014496856125198        0.013429506283518        0.013050916129492        0.014330865532458        0.012945688207854        0.007909960949355        0.00163945659304        -0.003817484750313        -0.002422586326797        0.01041702470197        0.010714854656412        0.002548746636191        -0.000685113348339        0.004911755375572        0.002329491242967        0.005618430130059        0.006832038149416        0.006340123587908        0.006672527300615        0.002171035624709        -0.003800854301886        -0.005382701880624        -0.004500024000686        -0.006342177657477        0.000147184949076        0.000516376619574        0.005449013262735        0.007350770331264        0.000795057463578        0.002231594436193        -0.002635417377871        0.003173404566244        0.007348177105809        0.009276424038697        0.007647523602248        0.01172153573549        0.010867259075895        0.002795068594199        0.002224730741137        0.003888987735109        0.002256760123298        0.001100200234348        0.005751462717665        0.007759016733352        0.004475790720135        -0.003639471583623        -0.000086721639253        -0.000138540859381        -0.008508895528911        -0.003921362880451        0.003337734656375        0.007848406078714        0.008716903172343        0.007270094776594        0.00653081684465        0.007959403303643        0.007880112311367        0.006567382828708        0.005154318578951        -0.0001739806594        -0.001692547260247        -0.002509185731972        0.003902946064732        0.002905788408087        0.00179203454514        -0.008371116981229        -0.005008304447648        -0.003510223594569        0.00504005190192        0.006221338685648        0.006998374731168        0.016707738726543        0.012994988191964        0.01074100619293        0.0117486402339        0.006898918844359        0.006997597400315        0.007576762133175        0.007500996520415        0.012495041270962        0.011332525807374        0.010643288446015        0.00251213212938        0.006451726443835        0.005789382262909        -0.003851753491372        0.000004173527762        -0.000517663532766        0.000688759035885        -0.005405756540743        -0.012788702417106        -0.008927956073252        -0.002128706088383        -0.005940994827045        -0.002385669788044        -0.002002716790947        -0.003358010311445        -0.000638182376576        -0.003055907607739        -0.012100763532613        -0.011244968308067        -0.013702402039292        -0.007581383531434        0.003657533864532        0.003235767694359        0.004507771692432        0.000266380386707        0.001854871507643        0.003090701619457        0.002384363144614        -0.001572302624194        0.000354850910695        -0.000856151108075        0.004784565123547        0.004905802755419        0.009685652583365        0.007059592210789        0.006538782741931        -0.000055878518894        -0.012644632280273        -0.01281383101676        -0.007853823694902        -0.011532197236233        -0.006259952510004        -0.002005086434878        0.001663955489326        0.003205953925185        0.002663950620028        -0.00254841508238        0.002701299622292        0.004338323318601        -0.006502372066007        -0.001743524542413        -0.000746473744987        -0.006461352389596        -0.022396935891624        -0.014775666485484        -0.005776919878882        -0.02371107946826        -0.025212716145677        -0.00548885632115        -0.018185017105322        -0.004828342530445        0.006450032224527        0.002616617935164        0.001360114984091        0.008312108824057        0.005967261075099        0.013356288334594        0.013437527141155        0.005652230768187        0.007768467158638        -0.013583391103735        -0.019104505535625        -0.010060415782192        -0.015031917313017        -0.014294679661868        -0.009188366690837        -0.019092282265485        -0.019317483836959        -0.010438990134408        -0.007056342735445        -0.028400314015925        -0.03393570485712        -0.02398958955594        -0.011624675284168        -0.007576691438129        -0.009453527961701        -0.003824789023565        -0.003188404226663        0.014251033229125        0.011763451016081        -0.001012176402438        -0.009681051514529        0.005741410637098        -0.011855851245049        -0.00114724225885        -0.013057744616753        -0.01525842453044        -0.011505282206191        -0.008199406340411        -0.012944534425369        -0.00683796160039        0.009535183489557        0.010800858117067        0.007681656343714        0.018398549208237        0.030703085521991        0.031869972150998        0.030959972713903        0.01976547481039        0.018572293702637        0.014780668844667        0.011489226516691        0.015914701565691        0.017899808608693        0.017623062147197        0.016063469348534        0.013951177796061        -0.003612932585528        -0.000994226042343        -0.001297350425643        -0.00235387127784        -0.003815622046796        0.003715285239229        0.002654896619874        0.012863856178968        0.0146221549678        0.010178886175737        0.003823702389831        0.001422515084738        0.005535922431611        0.00751582471176        0.000048345728273        0.006504376098843        0.007552738380179        0.006611340725092        0.009260181137725        0.003342261743879        0.009480826805412        0.011268045514019        0.009943980688416        0.008337754756965        0.004260613354983        -0.005880448340716        -0.007649734438511        -0.014737370908806        -0.009594157864266        -0.011356581889491        -0.009212901410291        0.001184472385859        -0.000135293393861        0.00181364554543        -0.00607951696509        0.004722708995462        0.001451167586684        0.00054948175609        0.004714249197734        -0.002369749414829        0.001302634365762        0.001717147376955        0.003802591415675        -0.003065051541904        -0.00612063728497        -0.01565219605796        -0.01192782506801        -0.013997413378323        -0.012043992529636        -0.020187200160364        -0.01156965748837        -0.011340965514841        -0.009113365364938        -0.011002447273111        -0.01232588097185        0.006701155385097        0.001693013435755        0.006147907450953        0.010349393828073        0.01092029376571        0.010297694511728        0.017184871453626        0.014314073801442        0.015286806895675        0.012264763224771        0.003548149690978        0.004182477472416        -0.01511962623559        -0.009549465911389        -0.005882636929985        -0.006486860891268        0.003814821956241        0.004527389382075        0.004824368548745        0.001345221511989        -0.000425513466506        0.000565189562965        0.007183669305017        0.01080787381601        0.013004409379118        0.009614001932285        0.004874945643836        0.004841259402415        0.002849955696663        0.004890639058453        0.010742445583379        0.010304189115352        0.013512936777248        0.014036454058481        0.002804788750704        0.010042693707735        0.010885118007817        0.020289354379438        0.019066321127613        0.019926587204882        0.017318286697706        0.013102153985523        0.007893745458659        0.005147512881911        -0.003386076666302        -0.004348544157668        0.000331389096931        0.001902165570248        -0.000361625787649        -0.008003096439127        -0.00894117360728        -0.004753215467941        -0.006229813929187        -0.005707648893506        -0.00930140501019        -0.018593789953882        -0.014458827164169        -0.02103057449504        -0.036895676339876        -0.02584745647848        -0.021039804056434        -0.018215635172856        -0.034432869972699        -0.035564088304467        -0.020076275467875        -0.034600288216009        -0.024211648019561        -0.026926225132186        -0.034935715217042        -0.034028418257274        -0.027777483917108        -0.025567312310524        -0.000866384156866        0.008046190383262        -0.000719855757479        -0.001690750669599        -0.0016946849694        -0.001971600146989        -0.002536448461527        -0.006209931847205        0.002912500396192        0.010755529528572        0.016276343920718        0.007950830989317        0.007412661191219        0.010621341213203        0.018114072469046        0.018773167405934        0.010757605449478        0.014476965061575        0.011992768757813        0.002303624447467        -0.000694997069742        0.002164698546972        0.001071526168773        -0.008798860086946        -0.005648395348598        -0.011627230436547        -0.00564172479264        -0.007955968309039        -0.001370943956045        0.002029146747898        0.00039394509995        -0.000137365925721        0.01202163670768        0.000243748173878        0.012175862008937        0.0094571203478        0.015595586015774        0.008705698296507        0.010703808802047        0.004173436994167        0.007075027224253        0.014982171124666        0.022646774565539        0.022196686180597        0.01543708510096        0.014829623778317        0.022895439882223        0.017699148545717        0.013553301086431        0.012263416921319        0.016506053577175        0.011599656329974        0.018741684268491        0.014531029505801        0.008380730059491        0.014505376179552        0.013947920561906        0.011945849018892        0.011698887977686        0.010082680954367        0.004515167239614        -0.006414691367893        -0.005520603636294        -0.004816042355451        -0.004102045480343        -0.003379953083946        -0.00265107675281        -0.001916704601588        -0.001178106334678        -0.000436538346026        0.000306751151719        0.001050516977419        0.001793511819724        0.00253448107202        0.003272157672749        0.019615887539964        -0.002664761635032        -0.001944875353108        -0.001233742478754        -0.000532774607472        0.007553858415634        -0.014563007270577        -0.013900993933447        -0.013254750393994        -0.012625530770911        -0.012014497136013        -0.011422723883823        -0.010851201974855        -0.010300843045151        -0.009772483375186        -0.009266887711799        -0.008784752937362        -0.008326711580856        -0.007893335166034        -0.007485137392266        0.008293487840808        -0.010930328959991        -0.010600322069946        -0.010297212701036        -0.010021315832939        -0.009772874936911        -0.009552063891742        -0.00517472107498        -0.009193689066604        0.001706986036108        -0.017013322730937        -0.028783144421316        -0.017282924981602        -0.021276031121607        -0.012320324725301        -0.020970496854664        -0.01424780032313        -0.033866742974741        -0.02062158096162        -0.026658483465869        -0.029736357597554        0.008847973302076        -0.003162020640321        0.008474694256847        0.002735917510296        0.002505856637487        0.010653177709738        0.004457917138712        0.001941967064017        -0.002785289603915        -0.005771183306537        0.000481945339425        0.000909549992617        -0.013036126837463        -0.005676909363184        -0.008378553521408        -0.008637245490996        -0.007942652796581        -0.00888682212741        0.001126862161702        0.005850170336762        0.006111218747285        0.004117440320885        0.012055151653468        0.019449488974675        0.013703353309919        0.021200435777055        0.019255004243745        0.029426005961009        0.034196234727702        0.031576485864086        0.022013129270114        0.021734310155322        0.022079207999349        0.016538374953375        0.023103589845094        0.013999211143426        0.006324533974853        0.001000206744352        0.015806406831716        0.016079054409542        0.015679711070428        0.023961381893195        0.01004323848336        0.007651685474701        0.01082345791177        0.008075988298515        0.001656507539758        -0.006299256410058        -0.003090724473943        -0.002991647304285        -0.007298446907409        -0.010752221841869        -0.006659824179564        0.000348925877028        0.008749765130743        0.018885782420689        0.009870325635315        0.010494386413532        0.005141987105405        0.014452599785875        0.011129748768688        0.01790497897082        0.015149990975236        0.017247375516567        0.014414635767837        0.018715944750698        0.040535187580391        0.041278697681637        0.041851215910992        0.042571565379811        0.036077622238471        0.041012088595584        0.041613798260117        0.041730817848975        -1.272956812892684        0.030397275562318        0.030519081096609        0.038513004999153        0.041057404969689        0.039562186859485        0.036086823397469        0.027568902482651        0.029040875908033        0.024047961286321        0.019614373795552        0.031185542975114        0.032569583432635        0.032149330115116        0.033487234799866        0.019124516914004        0.023655471435995        0.027619871002173        0.027392833475405        0.02793685726598        0.024412912074176        0.025250478251116        0.019974850031153        0.031822070815442        0.031104431259146        0.026245290126437        0.034033344331628        0.035041013454039        0.026695052472784        0.01838716404483        0.020149783475946        0.021617820007933        0.023502478080541        0.020435091737942        0.005217356554533        -0.005064876714163        -0.004301575947511        -0.003745612271114        -0.005357287737861        -0.006333662676065        -0.018296475908927        -0.032234313289406        -0.030547935546408        -0.019962117806281        -0.021706538124392        -0.021287193279028        -0.015991676139112        -0.015200094292416        -0.018858697921585        -0.00874082709014        -0.000652614726259        0.002367787018374        0.001103297091311        -0.014902287760829        -0.00401745670832        -0.013484806651829        -0.008418350645111        -0.006163251383365        -0.007076200227641        -0.001743589950168        0.012931524965025        0.007251130273739        0.013507481621106        0.00962357478905        0.007421580860819        0.015075744607183        0.013409564053238        0.012267212913084        0.007857971356325        0.006486440663547        0.011483431982981        0.005104112427025        0.005571207521907        0.010213788528161        -0.000506428875482        -0.001607733007837        -0.005838882911521        0.002340152276084        0.000262467661829        0.000465772389123        -0.007206346607822        -0.007400576800226        -0.004721776570725        -0.01100740611866        -0.007213139215336        -0.019417897546685        -0.021478632516168        -0.034938320592804        -0.036340724352632        -0.024553789201827        -0.021524093688043        -0.034430861412601        -0.03565048905559        -0.020122583810327        -0.003768948811296        -0.002932275264582        0.003196780816291        -0.001418005433942        -0.002789638818741        -0.00757472007642        -0.00835611607228        -0.018494911639164        -0.01681246580583        -0.007361846763214        -0.010376877031095        0.002726655719352        -0.004645185965992        -0.004549572873096        0.002076951056135        0.001711298796336        0.001339997909541        0.000964690617788        0.003917465857606        0.000208581786161        0.008109614693887        0.005837004864306        0.016805989492614        0.013281961327061        0.016081574390781        0.02621666531033        0.021799937526293        0.018957514525618        0.028043286146499        0.02475041037817        0.027440089208916        0.018686832529642        0.014787548447368        0.018698021120133        0.015834069201202        0.016935897458079        0.015348809558687        0.009187933114912        0.018878673994216        0.018694022460737        0.013951039262491        0.023365788737847        0.021666531591869        0.00451941534131        0.000299852160365        0.004235554443437        0.004170473249323        0.004035937578563        0.003366686221851        0.003767064198409        -0.025406671762813        -0.025547539777563        -0.02569339496697        -0.025845325877917        -0.026004242630933        -0.026639223387535        -0.024236341097744        -0.031213458038603        -0.02076253900492        -0.020288567665848        -0.019732557382747        -0.021619861175106        -0.029479149490876        0.002233659244875        -0.005625967234217        0.001748211799812        0.015423697189523        0.012864472359985        0.017061423837903        0.016213071027983        0.001956972721874        -0.003606283343673        0.011806526788712        0.010472986104458        0.005106060306237        0.004243249181111        0.005098827538648        0.018686454335946        0.013268930379905        0.012999024821448        0.013790425426088        0.020187604756171        0.022013387601819        0.014098586816214        0.005346370262958        -0.000207649963679        0.0002147357095        -0.015996961547134        -0.017303067755629        -0.016575544310866        -0.033105584277902        -0.031010629580082        -0.029994818252899        -0.016438528983476        -0.016758574085933        -0.00540282488609        -0.017413328605258        -0.023353694493011        -0.00923678319911        -0.021958674373329        -0.00695850239458        0.007441272375377        0.012887990217608        0.020934415316398        0.018876659964098        0.015213521947251        0.013207059311346        0.018844400026125        0.008938713253937        0.008600127748443        0.007210131982773        0.002897364098301        0.004270374202975        0.013430426171467        0.009009138420652        0.012877019568529        0.017089109801853        0.012602695024424        0.006866355324746        0.012102727671276        0.016753822540852        0.005907357636247        0.0006622078437        0.003020746633995        -0.009679118512926        -0.01173438194554        -0.003544760075174        -0.004437567711562        -0.008295263317579        -0.00587608563227        -0.009257592995082        -0.008115588438795        -0.009678153711785        -0.018148474089653
 楼主| 发表于 2007-11-30 03:20 | 显示全部楼层
请问这是咋回事
 楼主| 发表于 2007-11-30 17:29 | 显示全部楼层
怎么根据变换输出的Gam窗口重构原信号啊,关键这个我不会
好像需要把GAM扩展成M*N的矩阵
难道要对GAM进行周期延陀?
发表于 2007-11-30 19:43 | 显示全部楼层
本帖最后由 wdhd 于 2016-9-8 14:17 编辑

  贴一个短时傅立叶逆变换的程序,楼主看看是否有用。
  function [data]=invspecgram(B,NFFT,Fs,WINDOW,NOVERLAP);
  % INVSPECGRAM Performs the Inverse Short Time FFT (Inverse SPECGRAM).
  %% Usage: [data] = INVSPECGRAM(B,NFFT,Fs,WINDOW,NOVERLAP);
  % % B is the STFT data; NFFT is the number of points for which the FFT was
  % calculated per slice.
  % Fs is the sampling frequency of the original data. WINDOW is the window
  % length in samples; NOVERLAP is the number of samples which each FFT slide
  % overlap with each other.
  %% See also SPECGRAM, FFT and IFFT.
  stepsize = WINDOW - NOVERLAP;
  [a,b]=size(B);
  transB=zeros(size(b,a));
  ispecgram = zeros((((stepsize*b)+a)),1);
  B = ifft(B,NFFT);
  transB = B';
  counter3 = 1;
  for counter2= 1:1:b
  ispecgram(counter3:(((floor(a/2))-1)+counter3),1) = (transB(counter2,1:(floor(a/2)))') + ispecgram(counter3:(((floor(a/2))-1)+counter3),1);
  counter3 = counter3 + stepsize;endNX =(b*(WINDOW-NOVERLAP))+NOVERLAP;
  data =real(ispecgram) .* 2;data = data(1:NX);
  [ 本帖最后由 zhlong 于 2007-11-30 19:45 编辑 ]
 楼主| 发表于 2007-11-30 20:04 | 显示全部楼层
本帖最后由 wdhd 于 2016-9-8 14:17 编辑
原帖由 zhlong 于 2007-11-30 19:43 发表
贴一个短时傅立叶逆变换的程序,楼主看看是否有用。

这个程序怎么输入Gabor变换的高斯窗口,windows只是窗口长度啊
 楼主| 发表于 2007-11-30 20:19 | 显示全部楼层

回复 #6 zhlong 的帖子

这个程序的运行结果非常糟糕

不明白大家都是怎么做Gabor滤波的重构的
 楼主| 发表于 2007-12-1 02:02 | 显示全部楼层
这种重构方式也不理想,根本没法用
yh是tfrgabor生成的高斯窗

yh = padarray(yh,[0 length(y)*length(yh)],'circular','pre');
for k=1:length(y)
    a=0;
for i=1:m
    for j=1:n
        ss=(k-i*length(y)/m);
        if ss<=0
            ss=-ss+1;
        end
         a=ydgr(i,j)*yh(ss)*exp(sqrt(-1)*2*pi*j*k/n)+a;   
    end
end
y1(k)=a;
end
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-14 05:31 , Processed in 0.057277 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表