hi all.

It's been a while since I last visited, for a number of reasons.

I have a programming problem (two actually) I would like to run past the various experts found herein. I can work out simplistic solutions to both of them, but don't really have the experience to get the best results.

OK, problem the first: There is a system which samples a signal at about 333Hz. The raw output of this system is a stream of 16 bit values which vary over a range of around 1000 to 8000 (decimal) when correct, but occasionally there is a spurious value which can be wildly outside this range. Not noise precisely, but erroneous values due to the nature of the system. It is desired that the output of the system be a smoothed, scaled output at approximately 20Hz, with these rogue values removed.

Currently, I am doing it in a simplistic way by averaging together 15 samples, discarding any values that fall outside the 1000-8000 range, and summing then dividing by all the values left. On a good run this gives an average of 15 values, on a bad one it might be 8 or 9. The average is then divided by 375 to scale it to the correct range. This procedure, while fairly braindead, works reasonably well in that the results are mostly within 2LSB of the correct value.

However, occasionally a value that is legal but wrong gets through, which screws things up somewhat. The thing is that the output can't actually change by more than a certain amount every cycle, due to mechanical constraints in the mechanism this system is getting it's data from, but sometimes it will generate a value which is outside the "step size" for want of better expression.

I'm sure there is at least one far superior method of processing the raw data to get the results I need. What is it?

Problem the next: Consider a system consisting of three receivers fixed at the corners of a triangle of some given size (about 40cm on a side in this case, if that's relevant). Above this triangle in such a way that it forms a pyramid is a single transmitter. This can move in three axes, but will always remain above the plane formed by the three receivers. Additionally, the movement of the transmitter is essentially in a plane parallel to the plane of the triangle for the most part, but that plane can move towards and away from the receiver plane within certain limits.

The raw output of the system is an absolute distance from the transmitter to each of the receivers. The desired processed output is an X,Y coordinate pair for each set of measurements. Think of the transmitter as the handle of a joystick, the vertical axis of which is parallel to the plane of the triangle. I want to get the output of that joystick.

Any ideas?

pca
_________________________
Experience is what you get just after it would have helped...