LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

least mean square

hi ,
 
  I am trying to implement a least mean square algorithm with a dsk 6713 .
 
The steps are as follows .
 
- Generate a random set of data, " a ", ( 1 D array ) , 500 bits .  
 
- convolute  data array , " a " , with the channel component , " h " , (1 D array ) , 4 bits , which results in "ah " (taking into consideration only the first 500 bits after convolution).
 
- add some noise to " ah " , which results in " u '.
 
- parallely , i generate a set of initial weight  values , " w " (containing zeros to begin with)
 
- Now , i multiply the first 11 bits of  " u " with " w " . Subtract the resultant value from the correesponding element ( it is the 5th elemnt to begin with and keeps incrementing ) of " a " , which results in the error component " e".  
 
- Multiple " e " with a constant " mu " and i also multiply this with the first 11 bits of  "u ". then i add that to the weight value , thereby updating the weight value.
 
- Now , i take the square of the error and have to store the error value in a array for each loop sequence ( for a total of 488 iterations, which should result in a 1D array of 488 bits).
 
I am facing a couple of problems i want some help with .
 
First , in step 5 , i start with 11 bits . but for the second loop ,i need to take 2 - 12 bits and the third loop , the 3 - 13 and so on till 488. Not sure how i could go about taking 11 bits in a sequential order.
 
Second , in the last step , i need to store the data in an array , i tried doing so , but in every loop, it stores only the finally executed data .
 
Hoping someone can give me some advice on how i can go about completing this .
 
I am attaching the vi along with this . I am trying to implement in Labview what i have already done in MATLAB , so i am attaching the
MATLAB step sequence in a notepad file if that might offer more insight to the problem.
 
thank you ..
 
motorhead
0 Kudos
Message 1 of 10
(3,415 Views)


Message Edited by motorhead on 06-17-2008 12:48 AM
0 Kudos
Message 2 of 10
(3,414 Views)


Message Edited by motorhead on 06-17-2008 12:49 AM
0 Kudos
Message 3 of 10
(3,412 Views)
Hi motorhead,

is it allowed to use array functions (index array, array subset, split array,...) on your DSP target? This would help to rewrite your vi in a more "standard" fashion...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(3,393 Views)
Hi GerdW ,
 
   The only possible array blocks that can be used are " Array constant , replace array subset , reverse 1D array , rotate 1D array , array max and min , index array and array size .
 
motorhead
0 Kudos
Message 5 of 10
(3,375 Views)
Hi motorhead,

with some shift registers and index/replace operations this should work...
See attachment, you only have to correct the indices by adding constants to get the correct elements of your arrays!


Message Edited by GerdW on 06-17-2008 01:15 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(3,367 Views)
Hi  GerdW ,
 
   that was good .. thank you ..
 
but i have a couple of  questions  though . you said i have to " correct " the indices by adding constants to the indices . am not very familiar with index array block . so here are my questions , hope you will  answer them for me.
 
first, with reference to " a " ... during the execution of the ( 488 count )FOR loop ,  i have added a constant 4 , so that i can get  a (5) , a(6)  and a (7) for every increasing loop count . so is that correct way doing it ? .  
 
second , not sure about how the u((i-11):(i-1)) portion  FOR loop works . since i want the first 11 ( 1 - 11 ) elements and then for every increasing Loop count , the  2 - 12 th element and then 3 - 13 th element and so on .  how do i get that done ? . does the index point to the upper limit or the lower limit of the 500 elements ?
 
motorhead ..


Message Edited by motorhead on 06-17-2008 07:41 AM
0 Kudos
Message 7 of 10
(3,343 Views)
adding the change ..
0 Kudos
Message 8 of 10
(3,338 Views)
Hi motorhead,

it seems you mix the array element numbering of LabView and MatLab...
Labview uses indexes starting with "0" for the first array element! So first element has index=0, 2nd element index=1, 3rd index=2, and so on. To get first to eleventh element you need index 0...10 (!).

I changed the index in the FOR loop to start with 12th element by adding "11". All other indexes are referenced to i (like a(i-7) or u(i-11:i-1) ), no need to worry here. I also changed the loop count to 489, as there are 489 elements to process (number 12 to 500!).


Message Edited by GerdW on 06-17-2008 04:00 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(3,322 Views)
GerdW , Thank you for all your patience and help .. It is good to have people like you to help out people like me who are starting out .. hope you have a good week ahead . motorhead .
0 Kudos
Message 10 of 10
(3,306 Views)