Azzera filtri
Azzera filtri

Can not envelope my data

1 visualizzazione (ultimi 30 giorni)
David Harra
David Harra il 29 Ago 2022
Modificato: Star Strider il 29 Ago 2022
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.

Risposta accettata

Star Strider
Star Strider il 29 Ago 2022
Use the double function to conver the 16-bit integer data to double-precision floating point data..
You can change the double-precision result from envelope back to o16-bit integer with the int16 function later, if necessary.
.
  2 Commenti
David Harra
David Harra il 29 Ago 2022
Hey thanks I will try this.
Just wondering if you can explain exactly what int16 is and the difference between this and double precision.
Thanks 😀
Star Strider
Star Strider il 29 Ago 2022
Modificato: Star Strider il 29 Ago 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')]
int16_range = 1×2
-32768 32767
while for unsigned 16-bit integers it would be:
uint16_range = [intmin('uint16') intmax('uint16')]
uint16_range = 1×2
0 65535
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.
.

Accedi per commentare.

Più risposte (0)

Tag

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by