Clear Filters
Clear Filters

Use dsp.LMSFilter in a block-wise manner

1 view (last 30 days)
Hello all,
I want to use the dsp.LMSFilter command to use the LMS algorithm to search for the optimal solution to an adaptive filter, and have it run on a blockwise manner to be used in a real time like situation. It is not necessary to run in real time, but each consecutive block depends on the output of the dsp.LMSFilter.
A minimum working example that I currently use is:
lmsout = dsp.LMSFilter( LengthOfLMSFliter ,'StepSize', 0.018 );
for n = 1:NumberOfBlocks
[FilterdOutput , ErrorVector, FilterWeights] = lmsout( input( Block(n) )' , desired_signal( Block(n) )');
...
end
The ... indicates code that is not relevant to my question. The code that I have runs just fine, and does what I need it to do.
My question is: Is it possible to reuse the previous block's FilterWeights so as to converge to the solution faster? At the moment I need to increase the blocksize to give enough samples for the LMS algorithm to converge, however I would like to decrease the blocksize and not deteriorate the LMS performance.
Something along the lines of:
lmsout = dsp.LMSFilter( LengthOfLMSFliter ,'StepSize', 0.018 );
for n = 1:NumberOfBlocks
if ~exist('FilterWeights')
[FilterdOutput , ErrorVector, FilterWeights] = lmsout( input( Block(n) )' , desired_signal( Block(n) )');
else
[FilterdOutput , ErrorVector, FilterWeights] = lmsout( input( Block(n) )' , desired_signal( Block(n) )','InitialFilterWeights', FilterWeights);
end
...
end
I tried some of the suggested initialisation instructions from the documentation, but they seem to be addressing the initial definition at the dsp.LMSFilter level and not the lmsout call.
I hope this is clear. Any help is greatly appreciated,
Thanks in advance,
A.
  1 Comment
Sharan Paramasivam Murugesan
Edited: Sharan Paramasivam Murugesan on 3 Aug 2017
There are multiple ways to approach this, including using dsp.LMSFilter, dsp.BlockLMSFilter, or dsp.LMSUpdate as part of the solution we might suggest. Some of these possible solutions have access to set internal weights each time, and some retain the state internally (making that setting the internal weights unnecessary, as that may already be done for you using state persistence between each "step" call).
Questions to you:
  • Do you just want to call "reset" in between calls (to start with aninitial set of filter weights)? And then set the weights yourself before looping and calling the algorithm?
  • Is your "Block(n)" signal a one-channel signal with a block ofconsecutive input data? Or Is "Block(n)" signal multipleindependent scalar channels of data?
  • Is there a block diagram of what you are trying to achieve(including signal lengths and filter weights lengths) for idealalgorithm use?
That being said, in particular if you are interested in the full weights history for each and every sample inside the full block of processing inside the dsp.LMSFilter, then this example from the MATLAB help could be of use to you (likely you need to reset the weights before the first set of calls to the dsp.LMSFilter to start it in a known state prior to looping again):

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!