![]() This is to make a function like round() useful, which will only round to integer values. scale a signal from -1 to 1 volts to ☘ for a 4 bit quantization. The scalingFactor is simply a way to scale the original signal to the size of the quantization. This is the same as the scalingFactor as calculated in the code above. The second argument needs to be the value of the least significant bit. I wasn't familiar with quant, but it seems it would work just fine. I will leave graphing the function up to you.Įdit: To respond to abtj's comment about quant(): You already seem to have the ability to graph down. ![]() I will use round(), then scale the signal back to its original magnitude signal = round(signal) You now have the choice of four functions to use: floor() %round down to the nearest integer This gives you a signal ranging from -128 to 128. ScalingFactor = (signalMax-signalMin)/qLevels The next step will be to scale your signal to have the same magnitude as your number of bits. I am going to assume a power of two for digital convenience's sake. First you will need to determine the number of quantization levels.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |