当前位置:网站首页>Adaptive filter
Adaptive filter
2022-07-05 07:59:00 【feiyingzaishi】
1、LMS Filter Module simulation , Output will diverge , Mainly mu The value selection is inappropriate , Just choose a smaller value
2、 You can put online m File by matlab coder The tool is directly converted to C file ( Can't be used directly , Can be compared with reference )
3、 Revised the online C Code for reference
#include "LMS.h"
/* xn-------- Input signal sequence ( Column vector )
* itr------- The number of iterations , Scalar , The default is xn The length of ,M<itr<sizeof(xn)
* en-------- Error sequence (itr*1) Column vector
* dn-------- Desired response sequence ( Column vector )
* M--------- The order of the filter ( Scalar )
* mu-------- Convergence factor ( step ) Scalar
* W--------- Filter weight matrix , The size is M*itr
* yn-------- Actual output sequence ( Column vector )*/
/*LMS Concrete algorithm */
float * LMS_Filter(int itr, const float *xn, const float *dn, double mu, int length)
{
static int i = 0;
static int k = 0;
static float y = 0.0;
static float en[F_COUNT];
static float W[M][F_COUNT];
static float x[M];
static float yn[F_COUNT];
/* Create a en All zero matrix ,en(k) It means the first one k The error between the expected output and the actual input in the second iteration */
for (i=0; i<itr; i++)
{
en[i] = 0;
}
/* Create a W All zero matrix , Each line represents a weighting parameter , Each column represents an iteration */
for (i=0; i<M; i++)
for (k=0; k<itr; k++)
W[i][k] = 0;
/* Create a x All zero matrix */
for (i=0; i<M; i++)
x[i] = 0;
/* Iterative calculation */
for (k=M; k<=itr; k++)
{
/* filter M Input of two taps : from xn The first k-1 Take out the values in reverse order M Put the values of samples into x
* y Output for filter :W Of the K-2 Column and x Sum of products of */
for (i=0; i<M; i++)
{
x[i] = xn[k-i-1];
y += W[i][k-2] * x[i];
}
en[k-1] = dn[k-1] - y; // The first k The error of each iteration
/* Iterative formula for filter weight calculation */
for (i=0; i<M; i++)
{
W[i][k-1] = W[i][k-2] + 2*mu*en[k-1]*x[i];
}
y = 0.0;
}
/* Create a yn Full infinite matrix , Dimension and xn equally */
for (i=0; i<itr; i++)
{
yn[i] = 0.0;
}
/* When finding the optimal output sequence of the filter */
for (k=M; k<=length; k++)
{
for (i=0; i<M; i++)
{
x[i] = xn[k-i-1];
y += W[i][k-2]*x[i];
}
yn[k-1] = y;
y = 0.0;
}
return yn;
}
边栏推荐
- Global and Chinese market of urban rail connectors 2022-2028: Research Report on technology, participants, trends, market size and share
- [professional literacy] specific direction of analog integrated circuits
- 研究發現,跨境電商客服系統都有這五點功能!
- Shape template matching based on Halcon learning [v] find_ cocoa_ packages_ max_ deformation. Hdev routine
- Rename directory in C [closed] - renaming a directory in C [closed]
- Train your dataset with yolov4
- Consul安装
- Application of ultra pure water particle counter in electronic semiconductors
- C WinForm [change the position of the form after running] - Practical Exercise 4
- Volatile of C language
猜你喜欢
C WinForm [display real-time time in the status bar] - practical exercise 1
MySQL blind note common functions
About the problem that MySQL connector net cannot be cleared in MySQL
Win10 shortcut key
Create inf module in AMI code
C WinForm [exit application] - practice 3
UEFI development learning 2 - running ovmf in QEMU
Altium designer learning (I)
Altium designer 19.1.18 - clear information generated by measuring distance
Record the opening ceremony of Beijing Winter Olympics with display equipment
随机推荐
Basic embedded concepts
A complete set of indicators for the 10000 class clean room of electronic semiconductors
How to migrate the device data accessed by the RTSP of the easycvr platform to easynvr?
L'étude a révélé que le système de service à la clientèle du commerce électronique transfrontalier a ces cinq fonctions!
Cadence simulation encountered "input.scs": can not open input file change path problem
研究發現,跨境電商客服系統都有這五點功能!
Class of color image processing based on Halcon learning_ ndim_ norm. hdev
Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
C WinForm [help interface - send email] - practice five
Distinction between heap and stack
Communication standard -- communication protocol
Ads usage skills
Process communication mode between different hosts -- socket
Summary -st2.0 Hall angle estimation
solver. Learning notes of prototxt file parameters
导电滑环磨损快的原因
UEFI development learning 3 - create UEFI program
2021-10-28
A simple method to prove 1/t Fourier transform
Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)