Can not envelope my data
2 views (last 30 days)
Show older comments
I was looking to envelope my data so I can get the peaks and do some FFT on the data but when I go to envelope my signal I get an error
**Error using envelope (line 63)
Expected input to be one of
these types:
single, double
Instead its type was int16.
My array is 1x 2688 int 16
I am not sure what int 16 means or how to get around this>
Any help would be appreciated.
0 Comments
Accepted Answer
Star Strider
on 29 Aug 2022
2 Comments
Star Strider
on 29 Aug 2022
Edited: Star Strider
on 29 Aug 2022
My pleasure!
That is complicated to explain, so I will defer instead to the documentation on Numeric Types and specifically here, Integers. The int16 numeirc type is a 16-bit signed integer, meaning that the first bit is a sign bit and the other 15 bits express the numeric value. So the range is:
int16_range = [intmin('int16') intmax('int16')]
while for unsigned 16-bit integers it would be:
uint16_range = [intmin('uint16') intmax('uint16')]
Double precision values are discussed in the documentation on Floating-Point Numbers. There are important concepts here that are necessary to understand in order to use them effectively. The most important of these (in my opinion) is that binary representations of decimal fractions (however not integer values that can, within the limits of their representation, be represented exactly) are always approximate. The easiest way to illustrate this in the context of decimal numbers is the difference between the fraction and its decimal equivalent, 0.333333333... since no matter how many places that is extended to, multiplying it by 3 will never exactly equal 1, only 0.999999999..., similarly discussed in some detail with respect to binary numeric representation in Why is 0.3 - 0.2 - 0.1 (or similar) not equal to zero?
This is a short discussion of a much broader topic, however I hope it will serve as an introduction.
EDIT — Corrected typographical error.
.
More Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!