#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#define F_COUNT 1000
#define M 40
/* xn--------输入的信号序列(列向量)
* itr-------迭代次数,标量,默认为xn的长度,M<itr<sizeof(xn)
* en--------误差序列(itr*1)列向量
* dn--------所期望的响应序列(列向量)
* M---------滤波器的阶数(标量)
* mu--------收敛因子(步长)标量
* W---------滤波器权值矩阵,大小为M*itr
* yn--------实际输出序列(列向量)*/
//float xn[250] = {0.000,0.247,0.586,0.867,0.468,0.799,0.573,0.916,0.713,0.236,0.000,-0.310,-0.571,-0.872,-0.993,-0.941,-0.711,-0.969,-0.408,-0.272,-0.000,0.339,0.668,0.936,1.123,0.615,0.925,0.730,0.455,0.289,0.000,-0.201,-0.434,-0.572,-0.685,-0.873,-0.893,-0.569,-0.346,-0.213,-0.000,0.331,0.361,0.784,0.769,0.713,0.909,0.503,0.367,0.254,-0.000,-0.228,-0.371,-0.439,-0.686,-0.907,-0.795,-1.083,-0.508,-0.223,-0.000,0.316,0.417,0.708,0.631,0.824,0.793,1.067,0.608,0.205,-0.000,-0.233,-0.569,-1.030,-0.738,-0.864,-0.553,-0.922,-0.598,-0.332,-0.000,0.149,0.660,0.717,0.738,0.807,1.062,1.036,0.648,0.390,0.000,-0.184,-0.483,-0.553,-0.644,-0.824,-0.570,-0.581,-0.516,-0.285,0.000,0.261,0.525,0.670,0.989,0.718,0.942,0.971,0.725,0.246,-0.000,-0.218,-0.584,-0.458,-0.528,-0.716,-0.507,-0.809,-0.537,-0.339,-0.000,0.318,0.413,0.868,0.851,0.768,1.072,0.849,0.507,0.295,-0.000,-0.226,-0.554,-0.684,-0.782,-0.972,-0.765,-0.675,-0.725,-0.138,0.000,0.200,0.768,0.687,1.167,0.936,0.868,0.538,0.403,0.274,-0.000,-0.406,-0.395,-0.953,-0.937,-0.832,-0.659,-0.607,-0.449,-0.195,-0.000,0.228,0.386,0.731,0.860,0.623,0.766,0.767,0.680,0.256,-0.000,-0.178,-0.481,-0.756,-0.396,-0.945,-0.737,-0.548,-0.667,-0.296,-0.000,0.255,0.360,0.558,1.116,1.301,1.000,0.609,0.569,0.245,-0.000,-0.339,-0.763,-0.773,-1.043,-0.761,-0.805,-0.673,-0.685,-0.250,0.000,0.315,0.478,0.578,0.814,0.757,0.753,0.870,0.516,0.329,-0.000,-0.272,-0.383,-0.726,-0.633,-0.964,-1.014,-0.659,-0.548,-0.331,0.000,0.281,0.334,0.656,0.477,0.825,1.024,0.805,0.814,0.266,-0.000,-0.285,-0.419,-0.733,-0.748,-0.716,-0.741,-0.696,-0.840,-0.245,-0.000,0.233,0.529,0.914,0.635,0.409,0.840,0.889,0.245,0.326};
//float dn[250] = {0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309};
//float xn[500] ={0.000,0.289,0.299,0.731,0.963,1.066,0.991,0.847,0.661,0.204,0.000,-0.170,-0.535,-0.781,-1.064,-0.704,-0.891,-0.944,-0.575,-0.325,-0.000,0.241,0.647,0.826,1.063,0.809,0.866,0.897,0.404,0.313,0.000,-0.374,-0.760,-0.940,-0.642,-0.573,-0.601,-0.845,-0.467,-0.212,-0.000,0.272,0.369,0.732,0.649,0.733,1.028,0.642,0.447,0.371,-0.000,-0.305,-0.566,-0.581,-0.726,-1.057,-0.867,-0.641,-0.772,-0.242,-0.000,0.248,0.249,0.813,1.057,1.007,0.627,0.527,0.632,0.239,-0.000,-0.208,-0.592,-0.572,-0.754,-0.764,-1.094,-0.858,-0.552,-0.358,-0.000,0.172,0.580,0.738,0.869,0.715,0.991,0.809,0.374,0.275,0.000,-0.272,-0.767,-0.740,-0.809,-0.644,-0.860,-0.825,-0.751,-0.228,0.000,0.283,0.568,0.798,1.137,1.042,0.749,1.117,0.464,0.304,-0.000,-0.375,-0.410,-0.700,-0.709,-0.872,-0.826,-0.522,-0.574,-0.304,-0.000,0.251,0.489,0.369,0.633,0.718,0.885,0.764,0.480,0.314,-0.000,-0.331,-0.524,-0.743,-0.974,-0.906,-1.059,-0.627,-0.583,-0.269,0.000,0.226,0.623,0.339,0.724,1.333,1.171,0.739,0.410,0.242,-0.000,-0.313,-0.722,-0.706,-0.846,-0.868,-1.094,-0.683,-0.566,-0.216,-0.000,0.201,0.583,0.576,1.450,0.950,0.702,0.696,0.679,0.279,-0.000,-0.328,-0.506,-0.576,-1.123,-0.939,-0.653,-0.996,-0.660,-0.197,-0.000,0.326,0.440,0.794,0.833,0.857,0.659,0.946,0.586,0.276,-0.000,-0.366,-0.502,-0.616,-0.933,-1.081,-0.783,-0.520,-0.328,-0.208,0.000,0.339,0.391,0.698,0.915,0.768,0.919,0.612,0.398,0.219,-0.000,-0.251,-0.484,-0.722,-0.670,-0.792,-0.981,-0.889,-0.525,-0.292,0.000,0.248,0.481,0.813,0.809,1.129,0.662,0.777,0.453,0.280,-0.000,-0.145,-0.505,-0.616,-1.230,-1.109,-0.825,-0.634,-0.503,-0.293,-0.000,0.273,0.628,0.680,1.076,0.811,0.645,0.913,0.639,0.246,-0.000,-0.363,-0.493,-0.760,-1.076,-0.907,-0.674,-0.684,-0.665,-0.235,0.000,0.268,0.415,0.584,1.029,0.966,0.907,0.488,0.669,0.270,-0.000,-0.361,-0.392,-0.797,-0.603,-0.515,-1.101,-0.741,-0.580,-0.216,0.000,0.229,0.586,0.588,0.927,1.444,1.014,0.652,0.501,0.184,-0.000,-0.343,-0.665,-0.625,-0.926,-0.961,-0.867,-0.614,-0.444,-0.278,0.000,0.252,0.592,0.844,0.845,0.962,1.093,0.634,0.573,0.309,-0.000,-0.264,-0.527,-0.606,-1.136,-0.901,-0.711,-0.676,-0.700,-0.168,-0.000,0.331,0.617,0.506,1.197,0.839,0.911,0.628,0.523,0.193,0.000,-0.228,-0.497,-0.783,-0.867,-1.090,-0.876,-0.287,-0.471,-0.347,0.000,0.401,0.442,0.945,0.888,1.041,0.916,0.798,0.556,0.251,0.000,-0.202,-0.347,-0.651,-0.387,-0.970,-1.041,-0.487,-0.515,-0.247,-0.000,0.328,0.503,0.635,0.646,0.921,0.912,0.745,0.571,0.323,0.000,-0.242,-0.539,-0.802,-0.866,-0.969,-0.661,-0.829,-0.472,-0.267,0.000,0.273,0.565,0.328,1.025,1.221,0.636,0.692,0.442,0.154,-0.000,-0.275,-0.531,-0.840,-0.791,-0.833,-1.152,-0.610,-0.434,-0.309,0.000,0.276,0.531,0.618,1.089,0.942,0.999,0.910,0.612,0.150,0.000,-0.245,-0.541,-0.756,-0.530,-1.204,-0.915,-0.841,-0.513,-0.310,0.000,0.261,0.654,0.718,0.648,1.014,0.709,0.629,0.464,0.347,0.000,-0.210,-0.491,-0.824,-0.822,-0.803,-0.448,-0.535,-0.527,-0.166,0.000,0.246,0.448,0.576,1.016,0.561,0.994,0.680,0.497,0.317,0.000,-0.471,-0.365,-0.856,-1.064,-1.037,-0.895,-0.829,-0.202,-0.327,0.000,0.336,0.490,0.738,0.841,0.605,1.165,0.396,0.534,0.232,-0.000,-0.283,-0.274,-0.951,-0.713,-0.611,-0.709,-0.826,-0.488,-0.106,-0.000,0.257,0.646,0.904,0.944,0.919,1.128,0.496,0.452,0.199,-0.000,-0.186,-0.684,-0.756,-0.958,-1.020,-1.177,-0.622,-0.366,-0.209};
//float dn[500] ={0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,-0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588,-0.809,-0.951,-1.000,-0.951,-0.809,-0.588,-0.309,0.000,0.309,0.588,0.809,0.951,1.000,0.951,0.809,0.588,0.309,-0.000,-0.309,-0.588
评论0