Having no success using point by point division to derive impulse estimate. What am I doing wrong?
Show older comments
Hello All,
I have been trying to derive the impulse response of a filter by the technique of taking the cross correlation of the input and the output signal of a filter and dividing that by the auto-correlation of the input signal via point-by-point division.
I can derive the impulse response by using the "deconv" function (duh!) but something is not quite working out with the point-by-point division method.
I have attached my code in hopes someone can take a look at this and help me figure out what I am doing wrong here.
I am very new to DSP and I would really appreciate it if someone gave me some tips on how to troubleshoot this.
Thank you.
close all
clear all
%%Read finalPrjInput.txt into x(t)
x=[
3.7076359e-001
9.4844221e-002
-3.6735972e-002
1.5263228e-001
4.2329314e-001
4.0808151e-001
9.2413244e-002
-1.3615197e-001
3.2918836e-002
4.1469944e-001
5.2417327e-001
1.7930353e-001
-2.3732972e-001
-2.1974501e-001
2.3208969e-001
5.8121393e-001
3.9508553e-001
-1.1087403e-001
-3.1426990e-001
5.2182972e-002
5.4490122e-001
5.2405068e-001
-5.6643870e-002
-5.4637416e-001
-3.4058977e-001
3.9146207e-001
8.6591303e-001
5.6559341e-001
-1.7361075e-001
-5.4629271e-001
-1.7971329e-001
4.7860192e-001
6.9953945e-001
2.8621990e-001
-2.5471424e-001
-3.1968315e-001
1.4015216e-001
6.2676173e-001
6.6871601e-001
2.7735316e-001
-1.5658592e-001
-2.9855269e-001
-1.2820161e-001
1.5944028e-001
3.6748578e-001
3.7921054e-001
1.5097289e-001
-2.3691800e-001
-5.2688187e-001
-4.2149007e-001
1.1040476e-001
6.9131475e-001
8.1526895e-001
3.3894065e-001
-3.3923698e-001
-6.4818170e-001
-3.9292078e-001
9.9154743e-002
3.6661847e-001
2.7707929e-001
6.4538182e-002
-2.6504527e-002
-1.4157565e-002
-6.0281399e-002
-1.7643734e-001
-1.7710228e-001
5.4063684e-002
3.5408142e-001
4.3598133e-001
2.3940941e-001
2.9758755e-002
9.4316633e-002
3.8972768e-001
5.7330143e-001
3.9248459e-001
-2.6688451e-002
-3.2783256e-001
-3.1979027e-001
-1.4739495e-001
-5.8656290e-002
-8.3292414e-002
-2.5209798e-002
2.3706731e-001
5.3514074e-001
5.6560537e-001
2.4096328e-001
-1.8193008e-001
-3.5491115e-001
-1.8994362e-001
7.6587469e-002
1.5538736e-001
-5.2484823e-003
-2.1154116e-001
-2.6210657e-001
-1.4332221e-001
9.3475679e-003
9.0004902e-002
1.1516881e-001
1.4572798e-001
1.6525569e-001
7.8901631e-002
-1.5835675e-001
-4.3110311e-001
-5.0844866e-001
-2.2991620e-001
3.2507460e-001
8.4590092e-001
1.0000000e+000
6.9009153e-001
1.4212146e-001
-2.7073242e-001
-3.3167356e-001
-1.4180143e-001
1.2664298e-002
-4.4361172e-002
-2.2070358e-001
-2.9228253e-001
-1.7376791e-001
-1.8022396e-002
-3.7204656e-002
-2.5881102e-001
-4.9916346e-001
-5.7317714e-001
-4.8104843e-001
-3.5727009e-001
-2.7385177e-001
-1.6824443e-001
1.1876468e-002
1.5996081e-001
9.7116865e-002
-1.7645323e-001
-3.9052306e-001
-2.4755520e-001
2.3627922e-001
6.9081180e-001
7.3631776e-001
3.5258986e-001
-1.2940480e-001
-3.9053378e-001
-4.2264140e-001
-4.4271493e-001
-5.6438100e-001
-6.3923888e-001
-4.4768901e-001
1.2524842e-002
4.9404968e-001
7.4849248e-001
7.4584708e-001
6.2154512e-001
4.6376472e-001
2.3574472e-001
-8.0623121e-002
-3.4298350e-001
-3.3533700e-001
-8.1936559e-003
4.1773420e-001
6.2614933e-001
4.7793486e-001
1.0263299e-001
-2.4723843e-001
-3.8743184e-001
-2.6589517e-001
7.0150811e-002
4.8822297e-001
7.7393315e-001
7.3208843e-001
3.7049504e-001
-4.0990787e-002
-1.8613723e-001
-2.2887832e-002
1.5556163e-001
4.2031750e-002
-3.1229202e-001
-5.1948930e-001
-2.8937119e-001
2.0565112e-001
4.7934486e-001
2.5713240e-001
-2.1554262e-001
-4.4779106e-001
-2.5421477e-001
5.3354711e-002
5.3454717e-002
-2.7664166e-001
-5.3003637e-001
-3.4976031e-001
1.4719196e-001
4.9384603e-001
3.9078490e-001
1.5238742e-002
-2.1257634e-001
-1.0075682e-001
1.5649500e-001
2.7470912e-001
2.2715772e-001
2.2188289e-001
3.7393658e-001
5.1597258e-001
3.9911207e-001
3.3201904e-002
-2.6977896e-001
-2.2870134e-001
7.7646560e-002
2.7432235e-001
8.7702435e-002
-3.5826619e-001
-6.6214205e-001
-5.4123085e-001
-9.1703042e-002
3.2101408e-001
3.9084766e-001
9.7663388e-002
-3.2659633e-001
-5.9698967e-001
-5.5918122e-001
-2.6190186e-001
8.4632776e-002
2.4087807e-001
1.1006928e-001
-1.6352369e-001
-2.8619002e-001
-6.7780853e-002
3.7705358e-001
6.9423212e-001
5.9579331e-001
1.2446422e-001
-3.8483851e-001
-6.1059240e-001
-5.1397728e-001
-3.1818589e-001
-2.5080606e-001
-3.3071308e-001
-3.9889519e-001
-3.1823454e-001
-1.1062127e-001
9.2703174e-002
1.9570771e-001
2.0794578e-001
1.8892872e-001
1.6135120e-001
9.8515123e-002
-1.6846457e-002
-1.4628800e-001
-2.1574079e-001
-1.7366566e-001
-2.7704825e-002
1.6206339e-001
3.1359879e-001
3.5772365e-001
2.7380491e-001
1.1344509e-001
-1.9650348e-002
-4.4292493e-002
1.9900015e-002
5.2169568e-002
-6.8038904e-002
-3.3910322e-001
-6.1478364e-001
-7.1742546e-001
-5.8984381e-001
-3.4357937e-001
-1.5686121e-001
-1.1991300e-001
-1.7310271e-001
-1.8752625e-001
-9.7172406e-002
5.0688212e-002
1.6587402e-001
2.1693333e-001
2.4783543e-001
2.9485259e-001
3.0683156e-001
1.7518354e-001
-1.4116934e-001
-5.2723603e-001
-7.7089117e-001
-7.3357113e-001
-4.7419225e-001
-2.0289955e-001
-1.0464098e-001
-1.9721022e-001
-3.4719954e-001
-4.0864100e-001
-3.4078843e-001
-2.0660615e-001
-8.5731309e-002
-6.6769496e-003
4.7561276e-002
9.7420985e-002
1.4747616e-001
1.9636567e-001
2.4069682e-001
2.6191902e-001
2.2873168e-001
1.3542354e-001
3.7009025e-002
2.2010266e-002
1.2860552e-001
2.8937359e-001
3.7791532e-001
3.2461389e-001
1.8650261e-001
9.7938123e-002
1.5221798e-001
3.3101412e-001
5.3800890e-001
6.8270535e-001
7.2568547e-001
6.6177212e-001
4.8994222e-001
2.1504199e-001
-1.2972185e-001
-4.7670313e-001
-7.4255644e-001
-8.5079058e-001
-7.5006007e-001
-4.4256609e-001
-1.7254369e-002
3.5820405e-001
5.1930542e-001
4.1281810e-001
1.3030277e-001
-1.7257132e-001
-3.8836441e-001
-4.8649221e-001
-4.5362808e-001
-2.6103447e-001
6.4400886e-002
3.5479945e-001
3.6509582e-001
-4.1963720e-003
-5.4201563e-001
-8.4324780e-001
-6.5286679e-001
-1.1083127e-001
3.6662004e-001
4.6684075e-001
2.4191658e-001
-1.7090215e-003
-4.2094189e-002
5.8870824e-002
7.9969523e-002
-8.9201265e-002
-3.3872402e-001
-4.7614027e-001
-4.2080745e-001
-2.4601004e-001
-7.3554189e-002
2.1635198e-002
1.2735909e-002
-1.0452986e-001
-2.9045219e-001
-4.4227297e-001
-4.6465454e-001
-3.8341902e-001
-3.4233254e-001
-4.3385002e-001
-5.4943940e-001
-4.7112879e-001
-1.5137557e-001
1.4867940e-001
8.9650185e-002
-3.4833413e-001
-7.5920420e-001
-6.8158325e-001
-8.9248657e-002
5.3994277e-001
6.8622776e-001
3.0334889e-001
-1.6164562e-001
-2.5212031e-001
4.6357927e-002
3.5658324e-001
3.5550202e-001
9.2896111e-002
-1.3890677e-001
-1.6955863e-001
-1.0415929e-001
-1.2747985e-001
-2.4876374e-001
-3.0814213e-001
-2.0667887e-001
-4.8466588e-002
-2.0844949e-002
-1.7839641e-001
-3.9837117e-001
-5.3613538e-001
-5.6291232e-001
-5.2669401e-001
-4.3315317e-001
-2.3944804e-001
3.0016361e-002
2.3257656e-001
2.3363205e-001
7.1240452e-002
-6.2827012e-002
-2.9731849e-002
1.0297568e-001
1.4847194e-001
1.9751732e-002
-1.8887587e-001
-3.4389708e-001
-4.3456152e-001
-5.3574551e-001
-6.3376634e-001
-5.7898698e-001
-2.6894179e-001
1.6066476e-001
4.1473627e-001
3.4222858e-001
1.1138733e-001
2.1328856e-002
1.4779444e-001
2.4440595e-001
3.7122854e-002
-4.2110518e-001
-7.5853640e-001
-6.6457731e-001
-2.1587218e-001
2.1697009e-001
3.6515024e-001
3.0763945e-001
3.0975397e-001
4.7358575e-001
6.1506420e-001
4.9114189e-001
9.1899421e-002
-3.3785244e-001
-5.5033623e-001
-5.2203343e-001
-4.2307294e-001
-4.0574780e-001
-4.6527124e-001
-4.9632413e-001
-4.3369284e-001
-3.0601637e-001
-1.7458644e-001
-6.4240258e-002
3.2677396e-002
1.1303157e-001
1.5518167e-001
1.5524023e-001
1.5041575e-001
1.9241356e-001
2.9717837e-001
4.1888437e-001
4.6612978e-001
3.4974785e-001
4.4833179e-002
-3.6419102e-001
-7.0614801e-001
-8.3358542e-001
-7.4774809e-001
-6.0776913e-001
-5.8223328e-001
-6.7759420e-001
-7.3540347e-001
-6.2057481e-001
-3.9463282e-001
-2.6203515e-001
-3.3489152e-001
-4.8953919e-001
-4.9675478e-001
-2.8262952e-001
-9.9924398e-003
1.1939958e-001
9.9294976e-002
9.9920608e-002
2.2441163e-001
3.5996182e-001
3.2824923e-001
1.5024515e-001
7.1127337e-002
2.7819754e-001
6.4483193e-001
8.3460298e-001
6.7246442e-001
3.5091903e-001
2.1883165e-001
3.9519161e-001
6.5799899e-001
7.2366053e-001
5.6711720e-001
4.0640316e-001
4.0504828e-001
4.8426837e-001
4.6796424e-001
3.4294852e-001
2.7809434e-001
3.7969397e-001
5.1982018e-001
4.8297378e-001
2.5114788e-001
4.9853705e-002
7.8021622e-002
2.5984333e-001
3.4092656e-001
2.1192446e-001
4.4757549e-002
6.3589290e-002
2.4662454e-001
3.4980990e-001
2.2682463e-001
2.7686896e-002
8.1717226e-003
1.9100719e-001
3.2536249e-001
2.1104059e-001
-2.9367800e-002
-9.6448846e-002
9.5528273e-002
2.9153703e-001
2.1614449e-001
-5.9771976e-002
-1.9134344e-001
-1.9606368e-003
2.6872061e-001
2.5353517e-001
-6.2101091e-002
-2.9062848e-001
-1.2151403e-001
2.6031603e-001
3.6984514e-001
2.5036481e-002
-3.9152988e-001
-3.7387247e-001
7.8040728e-002
4.2724927e-001
2.4121095e-001
-2.6465272e-001
-4.6794691e-001
-1.0138657e-001
3.9144492e-001
3.7071340e-001
-2.0985635e-001
-6.9945607e-001
-4.9353535e-001
2.3865857e-001
7.1325737e-001
4.1309133e-001
-3.2595350e-001
-6.9847039e-001
-3.3172018e-001
3.2677154e-001
5.4789131e-001
1.3475970e-001
-4.0598080e-001
-4.7075037e-001
-1.0710034e-002
4.7611024e-001
5.1828090e-001
1.2714010e-001
-3.0657128e-001
-4.4830471e-001
-2.7771465e-001
1.0171853e-002
2.1846759e-001
2.3044818e-001
2.4719784e-003
-3.8515187e-001
-6.7484313e-001
-5.6917315e-001
-3.6994571e-002
5.4420471e-001
6.6845375e-001
1.9242581e-001
-4.8544594e-001
-7.9407928e-001
-5.3850148e-001
-4.6103603e-002
2.2168795e-001
1.3248205e-001
-7.9720332e-002
-1.7041888e-001
-1.5772235e-001
-2.0349120e-001
-3.1928676e-001
-3.1958595e-001
-8.8048879e-002
2.1234533e-001
2.9462703e-001
9.8442237e-002
-1.1081599e-001
-4.5860385e-002
2.4995366e-001
4.3393568e-001
2.5353234e-001
-1.6522195e-001
-4.6594211e-001
-4.5747066e-001
-2.8464100e-001
-1.9546283e-001
-2.1965429e-001
-1.6112188e-001
1.0161013e-001
4.0014357e-001
4.3107329e-001
1.0690136e-001
-3.1551679e-001
-4.8801763e-001
-3.2256485e-001
-5.5543524e-002
2.3751577e-002
-1.3638409e-001
-3.4217166e-001
-3.9222704e-001
-2.7292777e-001
-1.1973818e-001
-3.8556187e-002
-1.2862773e-002
1.8230714e-002
3.8297553e-002
-4.7512603e-002
-2.8422232e-001
-5.5641528e-001
-6.3320271e-001
-3.5410743e-001
2.0145086e-001
7.2284933e-001
8.7752519e-001
5.6819811e-001
2.0814019e-002
-3.9144932e-001
-4.5179536e-001
-2.6132362e-001
-1.0625377e-001
-1.6267065e-001
-3.3840002e-001
-4.0936149e-001
-2.9022498e-001
-1.3385320e-001
-1.5240483e-001
-3.7337622e-001
-6.1308938e-001
-6.8645949e-001
-5.9368294e-001
-4.6925252e-001
-3.8517791e-001
-2.7891009e-001
-9.8124543e-002
5.0628592e-002
-1.1542446e-002
-2.8443554e-001
-4.9782430e-001
-3.5417134e-001
1.3035219e-001
5.8557788e-001
6.3178091e-001
2.4875402e-001
-2.3253574e-001
-4.9295592e-001
-5.2435089e-001
-5.4370793e-001
-6.6465371e-001
-7.3878753e-001
-5.4650986e-001
-8.5564481e-002
3.9669557e-001
6.5187727e-001
6.4997438e-001
5.2641856e-001
3.6938787e-001
1.4212114e-001
-1.7348990e-001
-4.3508999e-001
-4.2667974e-001
-9.8769198e-002
3.2792926e-001
5.3711838e-001
3.8968125e-001
1.5160038e-002
-3.3392742e-001
-4.7333362e-001
-3.5100649e-001
-1.4166852e-002
4.0470214e-001
6.9121229e-001
6.5017067e-001
2.8938346e-001
-1.2129315e-001
-2.6562734e-001
-1.0156269e-001
7.7704976e-002
-3.5003767e-002
-3.8850350e-001
-5.9487387e-001
-3.6392602e-001
1.3192884e-001
4.0645791e-001
1.8508353e-001
-2.8675070e-001
-5.1815567e-001
-3.2373328e-001
-1.5315058e-002
-1.4363735e-002
-3.4360624e-001
-5.9614456e-001
-4.1500962e-001
8.2803990e-002
4.3032183e-001
3.2812685e-001
-4.6550795e-002
-2.7349503e-001
-1.6080239e-001
9.7324830e-002
2.1641657e-001
1.6974499e-001
1.6535213e-001
3.1828993e-001
4.6121213e-001
3.4523988e-001
-1.9779990e-002
-3.2186856e-001
-2.7989671e-001
2.7347373e-002
2.2492123e-001
3.9201244e-002
-4.0586563e-001
-7.0883794e-001
-5.8702144e-001
-1.3658660e-001
2.7703924e-001
3.4778320e-001
5.5510917e-002
-3.6783522e-001
-6.3731342e-001
-5.9858832e-001
-3.0039083e-001
4.7063398e-002
2.0422969e-001
7.4343278e-002
-1.9832596e-001
-3.2006725e-001
-1.0073178e-001
3.4503020e-001
6.6313750e-001
5.6562862e-001
9.5230594e-002
-4.1313998e-001
-6.3796064e-001
-5.4041125e-001
-3.4368461e-001
-2.7536856e-001
-3.5433844e-001
-4.2158252e-001
-3.3998299e-001
-1.3143002e-001
7.2834910e-002
1.7678068e-001
1.8996069e-001
1.7188627e-001
1.4525200e-001
8.3359800e-002
-3.1057338e-002
-1.5955390e-001
-2.2806122e-001
-1.8504014e-001
-3.8132943e-002
1.5258203e-001
3.0506455e-001
3.5013685e-001
2.6716583e-001
1.0775399e-001
-2.4393259e-002
-4.8087036e-002
1.7053983e-002
5.0272154e-002
-6.8987629e-002
-3.3910322e-001
-6.1383492e-001
-7.1552805e-001
-5.8699778e-001
-3.3978482e-001
-1.5211830e-001
-1.1422190e-001
-1.6646364e-001
-1.7993945e-001
-8.8638166e-002
6.0169569e-002
1.7630214e-001
2.2830781e-001
2.6015586e-001
3.0811849e-001
3.2104244e-001
1.9033886e-001
-1.2507015e-001
-5.1019357e-001
-7.5290609e-001
-7.1464411e-001
-4.5432398e-001
-1.8209080e-001
-8.2892532e-002
-1.7452289e-001
-3.2357418e-001
-3.8407849e-001
-3.1528971e-001
-1.8017218e-001
-5.8363075e-002
2.1624514e-002
7.6794904e-002
1.2758568e-001
1.7857078e-001
2.2838905e-001
2.7364775e-001
2.9579626e-001
2.6353395e-001
1.7114953e-001
7.3657403e-002
5.9579645e-002
1.6709448e-001
3.2878069e-001
4.1823907e-001
3.6585278e-001
2.2865508e-001
1.4100259e-001
1.9619282e-001
3.7589768e-001
5.8379949e-001
7.2940124e-001
7.7328491e-001
7.1027331e-001
5.3934334e-001
2.6534117e-001
-7.8526484e-002
-4.2461352e-001
-6.8957454e-001
-7.9691840e-001
-6.9529962e-001
-3.8691945e-001
3.9276386e-002
4.1561679e-001
5.7759797e-001
4.7198827e-001
1.9034834e-001
-1.1165263e-001
-3.2657487e-001
-4.2383416e-001
-3.9010388e-001
-1.9664650e-001
1.2965019e-001
4.2090764e-001
4.3206039e-001
6.3622079e-002
-4.7334586e-001
-7.7372930e-001
-5.8250217e-001
-3.9623182e-002
4.3866891e-001
5.3972769e-001
3.1563885e-001
7.2845803e-002
3.3290382e-002
1.3508230e-001
1.5700504e-001
-1.1344610e-002
-2.6004915e-001
-3.9665016e-001
-3.4050509e-001
-1.6489845e-001
8.3635743e-003
1.0435605e-001
9.6256740e-002
-2.0212198e-002
-2.0534087e-001
-3.5637119e-001
-3.7796554e-001
-2.9594607e-001
-2.5407893e-001
-3.4481907e-001
-4.5963447e-001
-3.8055325e-001
-6.0032836e-002
2.4078589e-001
1.8251697e-001
-2.5471055e-001
-6.6482736e-001
-5.8645669e-001
6.6240358e-003
6.3655799e-001
7.8358186e-001
4.0143821e-001
-6.2824770e-002
-1.5257165e-001
1.4663064e-001
4.5757625e-001
4.5721151e-001
1.9531825e-001
-3.5775837e-002
-6.5722782e-002
3.7756480e-004
-2.2245931e-002
-1.4283672e-001
-2.0152599e-001
-9.9377625e-002
5.9515724e-002
8.7814362e-002
-6.9064193e-002
-2.8837016e-001
-4.2546971e-001
-4.5158617e-001
-4.1471157e-001
-3.2051866e-001
-1.2616569e-001
1.4394228e-001
3.4714176e-001
3.4883222e-001
1.8707125e-001
5.3630058e-002
8.7347107e-002
2.2067211e-001
2.6678142e-001
1.3866980e-001
-6.9353685e-002
-2.2377528e-001
-3.1384463e-001
-4.1443807e-001
-5.1187292e-001
-4.5651217e-001
-1.4589019e-001
2.8428850e-001
5.3892750e-001
4.6698263e-001
2.3669950e-001
1.4719443e-001
2.7420868e-001
3.7136409e-001
1.6462012e-001
-2.9307360e-001
-6.2997531e-001
-5.3549156e-001
-8.6266620e-002
3.4709057e-001
4.9578074e-001
4.3877506e-001
4.4138975e-001
6.0571675e-001
7.4768543e-001
6.2424837e-001
2.2548613e-001
-2.0379052e-001
-4.1580416e-001
-3.8703627e-001
-2.8761576e-001
-2.6983572e-001
-3.2890937e-001
-3.5951759e-001
-2.9644680e-001
-1.6833599e-001
-3.6476898e-002
7.4293244e-002
1.7162964e-001
2.5239733e-001
2.9495569e-001
2.9541724e-001
2.9099049e-001
3.3338074e-001
4.3853266e-001
5.6062046e-001
6.0824234e-001
4.9223153e-001
1.8768261e-001
-2.2098122e-001
-5.6258323e-001
-6.8967107e-001
-6.0348958e-001
-4.6317189e-001
-4.3730276e-001
-5.3233585e-001
-5.8982276e-001
-4.7467723e-001
-2.4842386e-001
-1.1552032e-001
-1.8807632e-001
-3.4242915e-001
-3.4935545e-001
-1.3494644e-001
1.3796882e-001
2.6763345e-001
2.4779589e-001
2.4868296e-001
3.7342982e-001
5.0923025e-001
4.7776227e-001
2.9999717e-001
2.2111270e-001
4.2841061e-001
7.9526704e-001
9.8525447e-001
8.2332661e-001
5.0198624e-001
3.7009820e-001
5.4665181e-001
8.0964714e-001
8.7549090e-001
7.1912409e-001
5.5858084e-001
5.5739103e-001
6.3677045e-001
6.2061991e-001
4.9575202e-001
4.3103993e-001
5.3277589e-001
6.7303266e-001
6.3631106e-001
4.0460418e-001
2.0342325e-001
2.3169863e-001
4.1362202e-001
4.9480114e-001
3.6588913e-001
1.9880652e-001
2.1771675e-001
4.0082470e-001
5.0407695e-001
3.8115276e-001
1.8207030e-001
1.6260458e-001
3.4548369e-001
4.7987683e-001
3.6558694e-001
1.2520474e-001
5.8144066e-002
2.5013574e-001
4.4615323e-001]
figure(1); subplot(2,2,1);
plot(x);
title('Original Input Signal');
grid;
%%designing the FIR filter
% Filter created using "fir1" function
Fpass1 = 8000;
Fpass2 = 12000;
Fs = 200000;
b = fir1(40,[2*Fpass1/(Fs/2) 2*Fpass2/(Fs/2)],'bandpass');
fvtool(b,1,200000)
%%Test impulse response of the filter
N=128;
impulse=[1,zeros(1,N)]; % Defining an impulse
figure(3); subplot(2,2,1);
plot(impulse);
h=filter(b,1,impulse); % Apply the generated impulse at the filter's input
title('impulse function');
grid;
figure(3); subplot(2,2,2);
plot(h/max(h)); % Plot the normalized impulse response
title('Actual impulse response');
grid;
%%Running signal x(t) through the filter
convOut = conv(b,x) % Filtering signal using "conv"
figure(1); subplot(2,2,3);
plot(convOut);title('Filtered Signal usinig "conv"');
grid;
%%Finding Impulse Response Estimate using Cross-correlation
% The output derived using the "conv" function is cross-correlated
% with the input x
Rxy = xcorr(convOut,x);
figure(4); subplot(3,2,1);
plot(Rxy);title('Rxy using "conv" output');
grid;
% Autocorrelation of the input
Rxx = xcorr(x,x);
figure(4); subplot(3,2,3);
plot(Rxx); title('Autocorrelation of the input x')
grid;
% Using "deconv" here instead of point-by-point division
figure(4); subplot(3,2,4);
[u,l]=deconv(Rxy,Rxx);
plot(u); title('"deconv" with Rxy and Rxx');
grid;
% Flipping the result from the previous step to arrive at
% the impulse response estimation -- successful!
figure(3); subplot(2,2,4);
impulseEst=flipud(u);
plot(impulseEst/max(impulseEst)); title('Impulse Response Estimate');
grid;
% Here is my attempt to find the impulse response estimate using
% point-by-point division
figure(5); subplot(1,1,1)
imp2=Rxy(1:2047) ./ Rxx
plot(imp2); title('Impulse Response Estimate Using Point-by-Point Division');
grid;
Answers (1)
bym
on 29 Dec 2011
0 votes
you are successful using deconv; which is analogous to division in the frequency domain. I suggest you do the division in the frequency domain.
Categories
Find more on Smoothing and Denoising in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!