Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

Algorithm Challenge

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sean_Goddard
    replied
    How about THIS for an idea,

    A full colour "hodograph" in which (like the Whites "Signagraph") multiple samples are taken and multiple loops drawn. Where samples coincide in each "sweep" the "temperature" of tht point increases, so it initially draws the loop in say blue, then any points which are "hit" again in the subsequent passes, cause that point to go through a "temperature" range, ending in red. This would show the number of times a signal passed through that X-Y phase angle and would ceate a visual "fingerprint" of the target.

    Leave a comment:


  • Skippy
    replied
    Some more related linear approximations I found online:
    DSP Trick: Magnitude Estimator - dspGuru

    Leave a comment:


  • Skippy
    replied
    Glad you found it useful. ( Max + 3/8 * Min ) is not too tough to calculate, ( 3 * Min ) is ( Min + 2 * Min ) or ( Min + Min + Min ) , basic adding and shifting operations.

    Leave a comment:


  • Carl-NC
    replied
    Excellent paper, thanks! Exactly the kind of stuff I was looking for. For simplicity, I would use Max + Min/2 as it requires no multiplication, just a bit shift. The error is only 12% max.

    While phase is used to determine VDI, discrimination, and ground tracking magnitude is mostly used to determine audio loudness and depth estimation. Even a 40% error in magnitude (as with |X|+|R|) is not too big a deal. The audio will be louder for some targets and the depth reading will be a little deeper. "A little" is not the full 40% because signal strength is a 6th power function. Therefore, a 40% error in calculating the magnitude results in a 6% error in actual depth calculation. Using Max + Min/2 produces on a 2% depth error. I could live with either one.

    Leave a comment:


  • Skippy
    replied
    Quote myself: "If 'simple + dirty'​ is needed, (X + 0.41 * R) is better. Use it for 0 to 45 degrees. If R >X , then swap them over and apply the formula to 90 to 45 degrees.​"
    I should've added more details.
    The intention is to make the approximation correct ( ish ) at 45 degrees, as well as 0 degrees. So magnitude = ( X + 0.414 * R ) is the intended calculation. However, for simpler maths , you can use: ( X + 3/8 *R ), or better still: ( X + 13/32 *R ), which obviously are achievable with simple adding / shifting.
    However DSP experts often do this calculation, and a look in some books on the subject show some other variants.
    If you DON'T want accuracy at 0 and 45, but want the average to be better ( over the 45 degree range ), you can reduce the X scaling to approx 0.95. Then approximations like (15/16 * X + 15/32 * R ) and ( 31/32 * X + 13/32 * R ) can be useful.
    I've attached some pages from 'Understanding DSP' by Lyons, that show these approaches.

    vector01_20240105_0001.pdf
    Attached Files

    Leave a comment:


  • Skippy
    replied
    As I was unable to attach an Excel spreadsheet document to my earlier post, I've wrapped it in a zip file.
    In this zip file is a single .xlsx Excel file. arctancubic2.zip

    Leave a comment:


  • Skippy
    replied
    Quote:" .. and metal detector VDI error +/- 10 degrees at 30 cm distance from target, VDI is more or less OK for short distances, so there is need in metal detector VDI improvement"
    I sort of agree, but you have missed the details : Carl asked for an arctan approximation ( see the first post ) NOT a VDI generator. Maybe he wanted it for some further maths, like a fancy 3D multi-freq polar plot to out-do the Manticore? Or as his reply stated, auto-ground tracking algorithms. There are other uses for target/ground angle apart from simply creating a VDI readout.
    My first reply, detailing the logarithm scale approach to generating a VDI , catered for the VDI aspect neatly. My second reply addressed his request for an arctan calculator.

    Leave a comment:


  • ivconic
    replied
    At Deus 1, V5.21 it works quite accurate.
    I always switch on it when suspect bottle caps.

    Leave a comment:


  • Carl-NC
    replied
    Lissajous patterns, I remember those. The White's V3 had a color 3-frequency hodograph that was quite useful, especially for id'ing bottlecaps and other flat steel.

    Leave a comment:


  • moodz
    replied
    Originally posted by Carl-NC View Post

    What we want is a simple way to come up with some kind of phase representation of the target response. Whether it's for displaying a VDI or doing discrimination or ground tracking. In all cases, having extreme precision is not really necessary, but consistency is. If you are writing a ground tracking algorithm, you can write it whether the phase calculation is perfect, or is off by a few percent, as long as a particular phase is always off by the same amount. Same with Disc, same with VDI. Obviously a phase calculation that is closer is better than one that is not, as you will not need to make as many fudges to various end-use algorithms. Detectors using crappy micros fake this stuff all the time, and it's good enough that no one seems to notice. One of the best ground tracking designs is in the MXT, which uses a lowly PIC16C76 clocked at 8MHz. That what this thread is about, getting good-enough results on a crappy micro.
    well the human eye has the most powerful "DSP" in the brain behind it. What is needed is a signature analyser where the signals are represented as a shape / color maybe that changes with the target VDI / amplitude etc.

    eg the area and tilt of the circle changes with phase. Area changes with amplitude.

    Click image for larger version  Name:	image.png Views:	0 Size:	94.9 KB ID:	418644

    also check this link ..."https://complex-analysis.com/content/domain_coloring.html"

    Leave a comment:


  • pito
    replied
    The resulting new approximation has an error of only +/-0.35 degrees over the full 90 degree range.​ = and and metal detector VDI error + /- 10 deg. at 30 cm distance from target, VDI is more or less ok for short distances, so there is need in metal detector VDI improvement, algorithm can wait.

    Leave a comment:


  • Carl-NC
    replied
    Originally posted by Skippy View Post
    So you WERE wanting a VDI scale, and not actually an arctan calculation?
    What we want is a simple way to come up with some kind of phase representation of the target response. Whether it's for displaying a VDI or doing discrimination or ground tracking. In all cases, having extreme precision is not really necessary, but consistency is. If you are writing a ground tracking algorithm, you can write it whether the phase calculation is perfect, or is off by a few percent, as long as a particular phase is always off by the same amount. Same with Disc, same with VDI. Obviously a phase calculation that is closer is better than one that is not, as you will not need to make as many fudges to various end-use algorithms. Detectors using crappy micros fake this stuff all the time, and it's good enough that no one seems to notice. One of the best ground tracking designs is in the MXT, which uses a lowly PIC16C76 clocked at 8MHz. That what this thread is about, getting good-enough results on a crappy micro.

    Leave a comment:


  • Skippy
    replied
    Quote: "For a magnitude short-cut, instead of I would propose |X| + |R|."

    That's pretty 'rough'. If 'simple + dirty'​ is needed, X + 0.41 * R is better. Use it for 0 to 45 degrees. If R >X , then swap them over and apply the formula to 90 to 45 degrees.

    Quote: "Because you will almost always have some sort of look-up table to correlate the computed phase with a VDI number"

    So you WERE wanting a VDI scale, and not actually an arctan calculation? I did ask in my ( rather good ) reply detailing the logarithmic scaling, but it was completely looked over while you were consumed with attachment problems.

    Leave a comment:


  • Carl-NC
    replied
    Originally posted by Skippy View Post
    This was discussed in the previous 'arctan' thread:
    Arc tangent function - Geotech Forums (geotech1.com)
    That thread is only a year old and I had completely forgotten about it. Gettin' old. Yes, 90*R/(X+R) is a shortcut that works well enough. Because you will almost always have some sort of look-up table to correlate the computed phase with a VDI number, you can easily adjust for the 4° error in the estimation. If you need more accuracy, then certainly your correction method can be used. But so far I like the CORDIC approach the best, which doesn't require any multiplies and uses a very small LUT.

    For a magnitude short-cut, instead of I would propose |X| + |R|. The question now becomes, how much calculated depth error will that impose and is it reasonable?

    There is no right or wrong answer in any of this, it's just a challenge to spur discussion, see where it goes.

    Leave a comment:


  • Skippy
    replied
    Seeing as this 'challenge' seems to still be open ( no response from Carl ) , I spent some time over the Christmas holiday working on an Arctan approximation. I'm quite pleased with the result.

    I started with the simple approximation:

    arctan (x) ~ 90 * x/(x+1)

    This was discussed in the previous 'arctan' thread:
    Arc tangent function - Geotech Forums (geotech1.com)

    It's correct at 0, 45 and 90 degrees, but can be over 4 degrees in error elsewhere.
    The error term resembles a cubic equation, so I worked out a cubic correction term and computer-optimised it.
    The resulting new approximation has an error of only +/-0.35 degrees over the full 90 degree range.

    In summary:

    (1) calculate t = x/(x+1) ... or t = opposite/(opposite+adjacent) if you have I and Q values.
    (2) calculate f = -0.92735 * t * (t * (t - 1.5) + 0.5)
    (3) Revised arctan approximation = 90 * (t + f)

    Attached is a pdf explaining my calculations. There's also an Excel file with a full example (when I work out how ..) and the resulting error plot for the simple approximation, and the revised 'cubic' version.

    I originally did all the calculations in QuickBasic, so I've attached screengrabs of example code and results. The .XLS file is probably easier to play with, though.​

    Click image for larger version  Name:	ArctanCubic3.png Views:	0 Size:	47.5 KB ID:	418631
    Click image for larger version  Name:	AtnAdj1.png Views:	0 Size:	34.9 KB ID:	418632
    Click image for larger version  Name:	AtnAdj2.png Views:	0 Size:	31.0 KB ID:	418633
    IMG3_20240104_0001.pdf

    Leave a comment:

Working...
X