|
|
Thread Tools | Display Modes |
Ads |
#152
|
|||
|
|||
GPS Units = Show road steepness?
Radey Shouman wrote:
writes: On Wednesday, March 20, 2019 at 5:53:52 PM UTC-7, Radey Shouman wrote: James writes: On 21/3/19 3:37 am, wrote: On Tuesday, March 19, 2019 at 1:58:13 PM UTC-7, James wrote: On 20/3/19 4:20 am, Radey Shouman wrote: writes: [ ... ] averages in particular. And I think that it was Radey talking about using IIR which would require a high end FPGA wouldn't it? I'm buying a new, wireless VDO for $50. An IIR can be very simple to implement. The "leaky integrator" or "exponential filter" is probably the simplest digital low-pass filter possible: y_i = y_{i-1} + k (x_i - y_{i-1}) In C: y += k*(x - y); If you're not too fussed about the actual cutoff frequency the multiplication can be done as a shift. The precision used for the state, y, does need to be higher than that of the input. If you need precise control over the frequency response then more work in design and more expense in implementation is needed, but not always. y(i) = y(i-1) + k.x(i) - k.y(i-1) y(i) = y(i-1) - k.y(i-1) + k.x(i) k is usually a fraction, 0 k 1. To avoid floating point arithmetic and division, if you make it a binary fraction (1/2, 1/4, 1/8, 1/16, etc), you can implement the filter with bit shifts, and addition and subtraction only. -- JS Don't you think that it would all be a great deal easier to handle by multiplying it enough to make them whole numbers and then displaying them as if they had been fractional? Can you illustrate your point with an example? Sounds like fixed point arithmetic to me. Suppose you want to represent signed numbers with 16 bits, 8 of them fractional. 1.0 is represented as 256. 0.5 is represented as 128. If you multiply two 8.8 numbers together, you get a 16.16 number, shift right by 8, check for overflow, and you have another 8.8 number. -- Remember that multiplying and dividing in binary doesn't really exist and is a pain in the butt. So there are all sorts of shortcuts to make adding and subtracting operate using less time. Multiplying and dividing in binary makes perfect sense. Students and masochists do it on paper. Of course MPU's do this all in hardware. Although I haven't looked into it in a very long time I remember MPU's as being really hardware intense. Yeah, binary's not so bad. Try doing long division in hex or base 7 for extra points. For an instant migraine, I once read that a given number may not have a unique representation in an irrational base. |
#153
|
|||
|
|||
GPS Units = Show road steepness?
On 3/22/2019 5:01 PM, Ralph Barone wrote:
Radey Shouman wrote: writes: On Wednesday, March 20, 2019 at 5:53:52 PM UTC-7, Radey Shouman wrote: James writes: On 21/3/19 3:37 am, wrote: On Tuesday, March 19, 2019 at 1:58:13 PM UTC-7, James wrote: On 20/3/19 4:20 am, Radey Shouman wrote: writes: [ ... ] averages in particular. And I think that it was Radey talking about using IIR which would require a high end FPGA wouldn't it? I'm buying a new, wireless VDO for $50. An IIR can be very simple to implement. The "leaky integrator" or "exponential filter" is probably the simplest digital low-pass filter possible: y_i = y_{i-1} + k (x_i - y_{i-1}) In C: y += k*(x - y); If you're not too fussed about the actual cutoff frequency the multiplication can be done as a shift. The precision used for the state, y, does need to be higher than that of the input. If you need precise control over the frequency response then more work in design and more expense in implementation is needed, but not always. y(i) = y(i-1) + k.x(i) - k.y(i-1) y(i) = y(i-1) - k.y(i-1) + k.x(i) k is usually a fraction, 0 k 1. To avoid floating point arithmetic and division, if you make it a binary fraction (1/2, 1/4, 1/8, 1/16, etc), you can implement the filter with bit shifts, and addition and subtraction only. -- JS Don't you think that it would all be a great deal easier to handle by multiplying it enough to make them whole numbers and then displaying them as if they had been fractional? Can you illustrate your point with an example? Sounds like fixed point arithmetic to me. Suppose you want to represent signed numbers with 16 bits, 8 of them fractional. 1.0 is represented as 256. 0.5 is represented as 128. If you multiply two 8.8 numbers together, you get a 16.16 number, shift right by 8, check for overflow, and you have another 8.8 number. -- Remember that multiplying and dividing in binary doesn't really exist and is a pain in the butt. So there are all sorts of shortcuts to make adding and subtracting operate using less time. Multiplying and dividing in binary makes perfect sense. Students and masochists do it on paper. Of course MPU's do this all in hardware. Although I haven't looked into it in a very long time I remember MPU's as being really hardware intense. Yeah, binary's not so bad. Try doing long division in hex or base 7 for extra points. For an instant migraine, I once read that a given number may not have a unique representation in an irrational base. Don't need an irrational base, you can even do it in base 10: For example, 23.1999... (with the 9's repeating forever) equals 23.2, exactly. This topic is/was the source of endless arguments in ?sci.math? - it's been so long I've forgotten the group name. This is also a standard topic in a 3rd-4th year Real Analysis class, and there are plenty of FAQ web pages if you'd like to review the many valid arguments/proofs. In fact, in any simple base (e.g. 2, 8, 16, 3, etc.) any terminating (non-repeating) representation has an equivalent repeating representation. I'd have to think a while as to whether this holds for, say, irrational bases, though as I recall, some odd stuff happens there. Finally, none of this has any relevance for microprocessors that (inherently) carry a finite number of digits. Mark J. (I taught this stuff for years) |
#154
|
|||
|
|||
GPS Units = Show road steepness?
On Saturday, March 23, 2019 at 10:17:55 AM UTC-7, Mark J. wrote:
On 3/22/2019 5:01 PM, Ralph Barone wrote: Radey Shouman wrote: writes: On Wednesday, March 20, 2019 at 5:53:52 PM UTC-7, Radey Shouman wrote: James writes: On 21/3/19 3:37 am, wrote: On Tuesday, March 19, 2019 at 1:58:13 PM UTC-7, James wrote: On 20/3/19 4:20 am, Radey Shouman wrote: writes: [ ... ] averages in particular. And I think that it was Radey talking about using IIR which would require a high end FPGA wouldn't it? I'm buying a new, wireless VDO for $50. An IIR can be very simple to implement. The "leaky integrator" or "exponential filter" is probably the simplest digital low-pass filter possible: y_i = y_{i-1} + k (x_i - y_{i-1}) In C: y += k*(x - y); If you're not too fussed about the actual cutoff frequency the multiplication can be done as a shift. The precision used for the state, y, does need to be higher than that of the input. If you need precise control over the frequency response then more work in design and more expense in implementation is needed, but not always. y(i) = y(i-1) + k.x(i) - k.y(i-1) y(i) = y(i-1) - k.y(i-1) + k.x(i) k is usually a fraction, 0 k 1. To avoid floating point arithmetic and division, if you make it a binary fraction (1/2, 1/4, 1/8, 1/16, etc), you can implement the filter with bit shifts, and addition and subtraction only. -- JS Don't you think that it would all be a great deal easier to handle by multiplying it enough to make them whole numbers and then displaying them as if they had been fractional? Can you illustrate your point with an example? Sounds like fixed point arithmetic to me. Suppose you want to represent signed numbers with 16 bits, 8 of them fractional. 1.0 is represented as 256. 0.5 is represented as 128. If you multiply two 8.8 numbers together, you get a 16.16 number, shift right by 8, check for overflow, and you have another 8.8 number. -- Remember that multiplying and dividing in binary doesn't really exist and is a pain in the butt. So there are all sorts of shortcuts to make adding and subtracting operate using less time. Multiplying and dividing in binary makes perfect sense. Students and masochists do it on paper. Of course MPU's do this all in hardware. Although I haven't looked into it in a very long time I remember MPU's as being really hardware intense. Yeah, binary's not so bad. Try doing long division in hex or base 7 for extra points. For an instant migraine, I once read that a given number may not have a unique representation in an irrational base. Don't need an irrational base, you can even do it in base 10: For example, 23.1999... (with the 9's repeating forever) equals 23.2, exactly. This topic is/was the source of endless arguments in ?sci.math? - it's been so long I've forgotten the group name. This is also a standard topic in a 3rd-4th year Real Analysis class, and there are plenty of FAQ web pages if you'd like to review the many valid arguments/proofs. In fact, in any simple base (e.g. 2, 8, 16, 3, etc.) any terminating (non-repeating) representation has an equivalent repeating representation. I'd have to think a while as to whether this holds for, say, irrational bases, though as I recall, some odd stuff happens there. Finally, none of this has any relevance for microprocessors that (inherently) carry a finite number of digits. Mark J. (I taught this stuff for years) Try representing 15 in base 7. |
#155
|
|||
|
|||
GPS Units = Show road steepness?
On Saturday, March 23, 2019 at 10:17:55 AM UTC-7, Mark J. wrote:
On 3/22/2019 5:01 PM, Ralph Barone wrote: Radey Shouman wrote: writes: On Wednesday, March 20, 2019 at 5:53:52 PM UTC-7, Radey Shouman wrote: James writes: On 21/3/19 3:37 am, wrote: On Tuesday, March 19, 2019 at 1:58:13 PM UTC-7, James wrote: On 20/3/19 4:20 am, Radey Shouman wrote: writes: [ ... ] averages in particular. And I think that it was Radey talking about using IIR which would require a high end FPGA wouldn't it? I'm buying a new, wireless VDO for $50. An IIR can be very simple to implement. The "leaky integrator" or "exponential filter" is probably the simplest digital low-pass filter possible: y_i = y_{i-1} + k (x_i - y_{i-1}) In C: y += k*(x - y); If you're not too fussed about the actual cutoff frequency the multiplication can be done as a shift. The precision used for the state, y, does need to be higher than that of the input. If you need precise control over the frequency response then more work in design and more expense in implementation is needed, but not always. y(i) = y(i-1) + k.x(i) - k.y(i-1) y(i) = y(i-1) - k.y(i-1) + k.x(i) k is usually a fraction, 0 k 1. To avoid floating point arithmetic and division, if you make it a binary fraction (1/2, 1/4, 1/8, 1/16, etc), you can implement the filter with bit shifts, and addition and subtraction only. -- JS Don't you think that it would all be a great deal easier to handle by multiplying it enough to make them whole numbers and then displaying them as if they had been fractional? Can you illustrate your point with an example? Sounds like fixed point arithmetic to me. Suppose you want to represent signed numbers with 16 bits, 8 of them fractional. 1.0 is represented as 256. 0.5 is represented as 128. If you multiply two 8.8 numbers together, you get a 16.16 number, shift right by 8, check for overflow, and you have another 8.8 number. -- Remember that multiplying and dividing in binary doesn't really exist and is a pain in the butt. So there are all sorts of shortcuts to make adding and subtracting operate using less time. Multiplying and dividing in binary makes perfect sense. Students and masochists do it on paper. Of course MPU's do this all in hardware. Although I haven't looked into it in a very long time I remember MPU's as being really hardware intense. Yeah, binary's not so bad. Try doing long division in hex or base 7 for extra points. For an instant migraine, I once read that a given number may not have a unique representation in an irrational base. Don't need an irrational base, you can even do it in base 10: For example, 23.1999... (with the 9's repeating forever) equals 23.2, exactly. This topic is/was the source of endless arguments in ?sci.math? - it's been so long I've forgotten the group name. This is also a standard topic in a 3rd-4th year Real Analysis class, and there are plenty of FAQ web pages if you'd like to review the many valid arguments/proofs. In fact, in any simple base (e.g. 2, 8, 16, 3, etc.) any terminating (non-repeating) representation has an equivalent repeating representation. I'd have to think a while as to whether this holds for, say, irrational bases, though as I recall, some odd stuff happens there. Finally, none of this has any relevance for microprocessors that (inherently) carry a finite number of digits. Mark J. (I taught this stuff for years) Now I'm lost at what we were talking about, but my original point was that it is quite easy to use whole numbers to represent fractions. And you needn't worry about irrational numbers simply by limiting your max number of decimal points displayed. |
#156
|
|||
|
|||
GPS Units = Show road steepness?
Mark J. wrote:
On 3/22/2019 5:01 PM, Ralph Barone wrote: Radey Shouman wrote: writes: On Wednesday, March 20, 2019 at 5:53:52 PM UTC-7, Radey Shouman wrote: James writes: On 21/3/19 3:37 am, wrote: On Tuesday, March 19, 2019 at 1:58:13 PM UTC-7, James wrote: On 20/3/19 4:20 am, Radey Shouman wrote: writes: [ ... ] averages in particular. And I think that it was Radey talking about using IIR which would require a high end FPGA wouldn't it? I'm buying a new, wireless VDO for $50. An IIR can be very simple to implement. The "leaky integrator" or "exponential filter" is probably the simplest digital low-pass filter possible: y_i = y_{i-1} + k (x_i - y_{i-1}) In C: y += k*(x - y); If you're not too fussed about the actual cutoff frequency the multiplication can be done as a shift. The precision used for the state, y, does need to be higher than that of the input. If you need precise control over the frequency response then more work in design and more expense in implementation is needed, but not always. y(i) = y(i-1) + k.x(i) - k.y(i-1) y(i) = y(i-1) - k.y(i-1) + k.x(i) k is usually a fraction, 0 k 1. To avoid floating point arithmetic and division, if you make it a binary fraction (1/2, 1/4, 1/8, 1/16, etc), you can implement the filter with bit shifts, and addition and subtraction only. -- JS Don't you think that it would all be a great deal easier to handle by multiplying it enough to make them whole numbers and then displaying them as if they had been fractional? Can you illustrate your point with an example? Sounds like fixed point arithmetic to me. Suppose you want to represent signed numbers with 16 bits, 8 of them fractional. 1.0 is represented as 256. 0.5 is represented as 128. If you multiply two 8.8 numbers together, you get a 16.16 number, shift right by 8, check for overflow, and you have another 8.8 number. -- Remember that multiplying and dividing in binary doesn't really exist and is a pain in the butt. So there are all sorts of shortcuts to make adding and subtracting operate using less time. Multiplying and dividing in binary makes perfect sense. Students and masochists do it on paper. Of course MPU's do this all in hardware. Although I haven't looked into it in a very long time I remember MPU's as being really hardware intense. Yeah, binary's not so bad. Try doing long division in hex or base 7 for extra points. For an instant migraine, I once read that a given number may not have a unique representation in an irrational base. Don't need an irrational base, you can even do it in base 10: For example, 23.1999... (with the 9's repeating forever) equals 23.2, exactly. This topic is/was the source of endless arguments in ?sci.math? - it's been so long I've forgotten the group name. This is also a standard topic in a 3rd-4th year Real Analysis class, and there are plenty of FAQ web pages if you'd like to review the many valid arguments/proofs. In fact, in any simple base (e.g. 2, 8, 16, 3, etc.) any terminating (non-repeating) representation has an equivalent repeating representation. I'd have to think a while as to whether this holds for, say, irrational bases, though as I recall, some odd stuff happens there. Finally, none of this has any relevance for microprocessors that (inherently) carry a finite number of digits. Mark J. (I taught this stuff for years) Hi Mark. Math isn't my main thing, just a tool I keep in a box and pull out sometimes, so I'd forgotten about the alternate representation for terminating real numbers (that's probably not what they're actually called, but I hope you get my gist). However, when trying to find the web page that I'd gotten the original quote from, I came across this: "A non-integer representation uses non-integer numbers as the radix, or bases, of a positional numeral system. The numbers di are non-negative integers less than β. This is also known as a β-expansion, a notion introduced by Rényi (1957) and first studied in detail by Parry (1960). Every real number has at least one (possibly infinite) β-expansion." So in a non-integer base, a given number may not just have two representations, but an infinite number of them. Anyway, I do agree that this has nothing to do with cycling computers or cycling at all, but it's at least a more civil discussion than who's going to punch who in the head if they ever meet in person. Have a great day. |
#157
|
|||
|
|||
GPS Units = Show road steepness?
On 24/3/19 5:02 am, wrote:
Try representing 15 in base 7. 21 -- JS |
#158
|
|||
|
|||
GPS Units = Show road steepness?
On Saturday, March 23, 2019 at 1:55:57 PM UTC-7, James wrote:
On 24/3/19 5:02 am, wrote: Try representing 15 in base 7. 21 Yah, I thought I was missing something. -- Jay Beattie. |
#159
|
|||
|
|||
GPS Units = Show road steepness?
James wrote:
On 24/3/19 5:02 am, wrote: Try representing 15 in base 7. 21 Yes but only for some values of 7. -- duane |
#160
|
|||
|
|||
GPS Units = Show road steepness?
jbeattie wrote:
On Saturday, March 23, 2019 at 1:55:57 PM UTC-7, James wrote: On 24/3/19 5:02 am, wrote: Try representing 15 in base 7. 21 Yah, I thought I was missing something. -- Jay Beattie. For a while now, my wife has been quoting her age in hexadecimal. Between the ages of 48 and 57, it's quite flattering. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pothole gardener stars on Road Rage TV show | Alycidon | UK | 0 | February 10th 16 01:12 PM |
Show off now faces arrest after road damage | Alycidon | UK | 5 | October 5th 15 11:00 PM |
gps units | recycled[_2_] | General | 1 | July 26th 09 11:59 PM |
FS: 2 Polar Power units | Andre | Marketplace | 0 | June 17th 05 12:13 AM |
FS: 2 polar power units | Andre | Marketplace | 0 | June 11th 05 10:49 PM |