Steven Clark wrote: > We could try and normalize the complex product, but the universe > explodes if it has length 0 (divide by 0).
What do you want the answer to be in this case? You will only have a zero length vector from the conjugate multiplication if one of the original vectors is also zero length. So the angle difference between them is undefined anyway. One approach then would be to ensure this never happens, i.e., add a small epsilon to each input stream, and make epsilon small enough to not sufficiently impact the results for "typical" input values. Normalizing the conjugate product will then give you the cosine as the real value, as you mentioned. Or, you could just divide the abs value into the real value of the product, and avoid the extra calculation of the normed imaginary part which you are going to throw away. You could do this from Python with existing blocks. > Do any basic math/trig functions (cos, atan2, sqrt, etc) exist at the > python block level, or do I have to delve into C to use them? > Makefiles are scary :( You'll pretty much need write your own low-level block if you want to use this approach. An alternative is to step back and look at the bigger picture of what you are trying to do. What do you need the cosine of the angle difference for? Does it really need to be normalized? Is there a way to use the conjugate product itself downstream in your calculation? That is, can you "stay" in the rectangular representation instead of going to sin/cos? Is there a way you can guarantee the input streams never have zero norm? -- Johnathan Corgan Corgan Enterprises LLC http://corganenterprises.com _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio