Results not correct when using diff function in Matlab -


i'm using diff matlab function difference between 2 successive values. , shown here in vector nz in link shown in nz difference between col 261 , 260 -1342 when use script result of difference between coloumns don't appear in result dnz. if advise why not working? attempt:

load('nz.mat'); dnz = diff(nz); 

if type class(nz) see data unit16. , matlab saturates results when dealing integer values, i.e. since 0 - 1342 lower 0 (the smallest value in uint16) returns zero:

>> dnz=diff(nz); >> dnz(260)  ans =        0 

if convert class can accomodate -1342 int16 get

>> dnz = diff(int16(nz)); >> dnz(260)  ans =    -1342 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -