Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Convert uint16 to continuous values
Replies: 6   Last Post: Oct 12, 2013 1:22 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
David Quilligan

Posts: 10
Registered: 10/11/13
Re: Convert uint16 to continuous values
Posted: Oct 12, 2013 10:29 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

dpb <none@non.net> wrote in message <l3bkkh$1s6$1@speranza.aioe.org>...
> On 10/12/2013 8:47 AM, David Quilligan wrote:
> > dpb <none@non.net> wrote in message <l3bieb$s1j$1@speranza.aioe.org>...
> >> On 10/12/2013 7:45 AM, David Quilligan wrote:
> >> > Hello,
> >> > I have logged timestamps from an ADC which are in unit16 format, i.e.
> >> > the count resets to zero after 65536. How can I easily convert these
> >> > values into continuous values (i.e. does not return to zero after

> >> 65536.
> >> > This is easy if the ADC only resets to zero once during my application
> >> > (just add 65336 to each value). However my application does not always
> >> > run for the same length of time and the count resets to zero many many
> >> > times during it.

> >>
> >> If you have Signal Processing Toolbox,
> >>
> >> doc unwrap
> >>
> >> If not, just look for the large negative jumps in succession and then
> >> add 64k from each to the end in succession--when done you've unwrapped
> >> the whole thing...
> >>
> >> Or, of course, you can return the full vector and build a sectional
> >> vector of n*64k and add it all at once.
> >>
> >> --

> >
> > Could you explain how I would add 64k in succession? I am able to add
> > 64k to my first block. However the second block would require 64k by 2,
> > the 3rd 64k by 3 and so on. And I'm having difficulty finding an easy
> > method to this. Sorry my Matlab experience is very limited.

>
> The simplest is to use a loop and if ix is the location of the jump
>
> x(ix:end)=x(ix:end)+64k;
>
> then repeat. You've only added 64k at a time, but each time you've done
> it for the remainder so when you move ix up to the next, it gets n*64k
> after n iterations.
>
> Alternatively, you use two ranges; ix1 and ix2 and walk thru building a
> vector that is n*64k for each subsection.
>
> --

Thanks for your help I really appreciate it.

I all most have it now.

Currently I have:

for r = 1:nrows
for c = 2:nrows
if c - r < 0
ix = ?????
A(ix:end) = A(ix:end) + 65536;
end
end
end

Last problem is specifying ix as the the location of the jump?

Thanks again for the help.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.