 # fxlms_code.rar

• laoning66
了解作者
• matlab
开发工具
• 2KB
文件大小
• rar
文件格式
• 0
收藏次数
• 10 积分
下载积分
• 17
下载次数
• 2018-05-25 15:30
上传日期 fxlms_code.rar
• fxlms_code.m
5.3KB

%-------------------------------------------------------------------------- % One of my friends asked me about the FxLMS algorithm. So, in return, % I provided him a little example of a single channel feed-forward active % noise control system based on the FxLMS. You can find many good % information in "Active Noise Control Systems - Algorithms and DSP % Implementations," written by S. M. Kuo and D. R. Morgan in 1996. % % Here is the sketch of the system. % % +-----------+ + % x(k) ---+--->| P(z) |--yp(k)----------------> sum --+---> e(k) % | +-----------+ ^- | % | | | % | \ ys(k) | % | +-----------+ +-----------+ | | % +--->| C(z) |--yw(k)-->| S(z) |---+ | % | +-----------+ +-----------+ | % | \ | % | \----------------\ | % | \ | % | +-----------+ +-----------+ | % +--->| Sh(z) |--xs(k)-->| LMS |<-------+ % +-----------+ +-----------+ % % I used FIR filter to model P(z), C(z), S(z), and Sh(z). % % Imagine that the noise x(k) is propagating from the source to the sensor, % through the fluid medium P(z). The sensor measures the arriving noise as % yp(k). % % To reduce noise, we generate another 'noise' yw(k) using the controller % C(z). We hope that it destructively interferes x(k). It means that the % controller has to be a model of the propagation medium P(z). Least mean % square algorithm is applied to adjust the controller coefficient/weight. % % However, there is also fluid medium S(z) that stay between the actuator % and sensor. We called it the secondary propagation path. So, to make the % solusion right, we need to compensate the adjustment process using Sh(z), % which is an estimate of S(z). % % Let's start the code :) % % Developed by Agustinus Oey <oeyaugust@gmail.com> % Center of Noise and Vibration Control (NoViC) % Department of Mechanical Engineering % Korea Advanced Institute of Science and Technology (KAIST) % Daejeon, South Korea %-------------------------------------------------------------------------- % Set simulation duration (normalized) clear; close all; clc; T=1000; % We do not know P(z) and S(z) in reality. So we have to make dummy paths Pw=[0.01 0.25 0.5 1 0.5 0.25 0.01]; Sw=Pw*0.25; % Remember that the first task is to estimate S(z). So, we can generate a % white noise signal, x_iden=randn(1,T); % send it to the actuator, and measure it at the sensor position, y_iden=filter(Sw, 1, x_iden); % Then, start the identification process Shx=zeros(1,16); % the state of Sh(z) Shw=zeros(1,16); % the weight of Sh(z) e_iden=zeros(1,T); % data buffer for the identification error % and apply least mean square algorithm mu=0.1; % learning rate for k=1:T % discrete time k Shx=[x_iden(k) Shx(1:15)]; % update the state Shy=sum(Shx.*Shw); % calculate output of Sh(z) e_iden(k)=y_iden(k)-Shy; % calculate error Shw=Shw+mu*e_iden(k)*Shx; % adjust the weight end % Lets check the result subplot(2,1,1) plot([1:T], e_iden) ylabel('Amplitude'); xlabel('Discrete time k'); legend('Identification error'); subplot(2,1,2) stem(Sw) hold on stem(Shw, 'r*') ylabel('Amplitude'); xlabel('Numbering of filter tap'); legend('Coefficients of S(z)', 'Coefficients of Sh(z)') % The second task is the active control itself. Again, we need to simulate % the actual condition. In practice, it should be an iterative process of % 'measure', 'control', and 'adjust'; sample by sample. Now, let's generate % the noise: X=randn(1,T); % and measure the arriving noise at the sensor position, Yd=filter(Pw, 1, X); % Initiate the system, Cx=zeros(1,16); % the state of C(z) Cw=zeros(1,16); % the weight of C(z) Sx=zeros(size(Sw)); % the dummy state for the secondary path e_cont=zeros(1,T); % data buffer for the control error Xhx=zeros(1,16); % the state of the filtered x(k) % and apply the FxLMS algorithm mu=0.1; % learning rate for k=1:T, % discrete time k Cx=[X(k) Cx(1:15)]; % update the controller state Cy=sum(Cx.*Cw); % calculate the controller output Sx=[Cy Sx(1:length(Sx)-1)]; % propagate to secondary path e_cont(k)=Yd(k)-sum(Sx.*Sw); % measure the residue Shx=[X(k) Shx(1:15)]; % update the state of Sh(z) Xhx=[sum(Shx.*Shw) Xhx(1:15)]; % calculate the filtered x(k) Cw=Cw+mu*e_cont(k)*Xhx; % adjust the controller weight end % Report the result figure subplot(2,1,1) plot([1:T], e_cont) ylabel('Amplitude'); xlabel('Discrete time k'); legend('Noise residue') subplot(2,1,2) plot([1:T], Yd) hold on plot([1:T], Yd-e_cont, 'r:') ylabel('Amplitude'); xlabel('Discrete time k'); legend('Noise signal', 'Control signal') 相关推荐
• fxlms算法.rar
fxlms 算法实现，主要描述了fxlms算法的代码实现步骤
• FXLMS_offline_feedforward.rar
实现前馈离线传递函数建模FXLMS算法仿真
• try_fxlms.zip
考虑次级声反馈的自适应滤波器算法，基本原理是最小均方误差
• fxlms.zip
fxlms基本算法在有源噪声控制中的应用，有MSE曲线图
• 基于FXLMS算法的主动噪声控制.zip
基于FXLMS算法的主动噪声控制，完成的是单频率的前馈双通道的主动噪声控制算法
• FXLMS.zip
滤波Xlms算法，可以用于主动噪声控制，有源噪声控制，等耳机汽车领域
• FxLMS算法.zip
FxLMS算法实现，包括了LMS算法，可以自己在此基础上修改成其他算法。
• 降噪耳机自适应算法
随着人们交通出行的日益频繁，环境噪声已严重影响到...但基于FXLMS算法设计的降噪耳机，使用过程中存在收敛速度慢，仅对窄带噪声效果好，而对宽带噪声控制效果不理想等问题，因此在很多场景下无法得到较好的降噪效果。
• 权重系数确定matlab代码-Feedback-ANC-Teensy-3.6:基于FxLMS算法和Teensy3.6微控制器的反
该反馈有源噪声消除系统基于FxLMS算法。 由于仅拾取反馈信号，因此反馈系统在消除窄带信号方面最有效。 图1：物理反馈系统 图2：基于FxLMS的反馈系统 在反馈系统中，只有误差传感器（麦克风）和辅助信号源（扬声器）...