Thread: Algorithm for target detection in C language

  1. #1
    Registered User
    Join Date
    Dec 2016
    Posts
    34

    Algorithm for target detection in C language

    Hi Members,

    I need to implement a target detection algorithm in C language for 8-bit microcontroller.

    Controller will be delivering signal value in continuous manner along with noise value. Noise value will be constant for one full operation whereas signal value will keep changing. The algorithm has to assume next signal as valid only when its greater than previous signal + noise value.

    This way keep updating next signal and reach to a position where next values start coming lesser considering noise as well and tell that value as target value.

    I need help to write the algorithm in C. Please help. Any refinement in algorithm is most welcome.

    Thanks & regards,
    David.

  2. #2
    Registered User
    Join Date
    Dec 2016
    Posts
    34
    Hi All,

    I just wanted to add that values are integer value between 0-2048. Target can be any value as i told in previous mail. Coming values are not of fixed size its a sequence.

    Thanks
    Davit

  3. #3
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    I'm unsure how the new noise values come in so I wrote that generally. If there are a fixed number of signal values between noise values then a double loop would probably work well.
    Code:
    prev = 0             # previously accepted signal (ultimately the target)
    noise = 0
    read signal          # accept first signal unconditionally
    loop:
       if new noise value available:
           read noise
       read signal
       if abs(signal - prev) >= noise:
           if signal < prev:           # Signal went down ..
               end loop                # .. so stop.
           prev = signal
    target = prev

  4. #4
    Registered User
    Join Date
    Dec 2016
    Posts
    34
    Hi Algorism,

    Thanks for the help. I have tried and it works. But I need to refine this algorithm.
    Noise is constant for one set of calculation. There is no limit of incoming signal. It keeps on coming and we need to keep showing target.
    I want your opinion on Noise. Do we need to consider next signal as valid only when previous signal + noise. Is it correct? It was my assumption.
    If you can give better idea it would be great. Please give me a better algorithm if possible.


    Thanks,
    david.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 07-29-2016, 04:53 PM
  2. sink detection algorithm
    By Mr.Lnx in forum Tech Board
    Replies: 2
    Last Post: 03-26-2013, 09:37 AM
  3. Breakout Collision Detection Algorithm Help
    By xmltorrent in forum Game Programming
    Replies: 8
    Last Post: 08-24-2006, 02:32 PM
  4. duplicate detection algorithm
    By Gustaff in forum C Programming
    Replies: 4
    Last Post: 01-28-2003, 12:26 PM
  5. Collision detection algorithm
    By Hannwaas in forum Game Programming
    Replies: 5
    Last Post: 11-30-2001, 01:27 PM

Tags for this Thread