shift of a fractional number of samples

View: New views
7 Messages — Rating Filter:   Alert me  

shift of a fractional number of samples

by Eric Chassande-Mottin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have written a function (code attached, fracshift.m) which performs the shift of a data vector
(e.g., a time-series) by a fractional number of samples. this is useful
in area such as antenna array processing and possibly
others (processing of stereo audio signals?). It is fairly
well documented, has the GPL and include three sanity checks.

As far as I know, there is no equivalent in the matlab world.
I would fit in the signal toolbox. Would you agree if I include it
there?

cheers,
eric



Re: shift of a fractional number of samples

by dbateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Eric Chassande-Mottin wrote:
I have written a function (code attached, fracshift.m) which performs the shift of a data vector
(e.g., a time-series) by a fractional number of samples. this is useful
in area such as antenna array processing and possibly
others (processing of stereo audio signals?). It is fairly
well documented, has the GPL and include three sanity checks.
Cute, and I can see the use of such a function for clock offset calculations in comms systems. I typically use simpler narrwband approximations for this functionality as I have to worry about how to implement it on an ASIC.

The interpolator must introduce a colored noise to the signal, that depends on the signal given to the function, and the characteristics of the interpolating filter. Have you any idea of the magnitude of the error introduced with the default filter? If so it would probably makes sense to document it in the help string so that others kno what to expect. I'd check myself, but am writing from an EEE PC without a copy of Octave installed to check with.

A couple of comments on the code itself, could you move the copyright to above the function definition, and the help text immediately following it with a single blank line between the copyright and the help text. This will be more consistent with the rest of Octave.

As far as I know, there is no equivalent in the matlab world.
I would fit in the signal toolbox. Would you agree if I include it
there?
seems like a good thing. I'd say go ahead and commit it.

D.

Re: shift of a fractional number of samples

by Eric Chassande-Mottin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Cute, and I can see the use of such a function for clock offset calculations in comms systems. I
> typically use simpler narrwband approximations for this functionality as I have to worry about how
> to implement it on an ASIC.

good to know that this work could be useful elsewhere!

> The interpolator must introduce a colored noise to the signal, that depends on the signal given to
> the function, and the characteristics of the interpolating filter. Have you any idea of the magnitude
> of the error introduced with the default filter? If so it would probably makes sense to document it in
> the help string so that others kno what to expect. I'd check myself, but am writing from an EEE PC
> without a copy of Octave installed to check with.

the parameter log10_rejection determines the interpolation error in
the working band of the interpolator. if you make a script with the
first test and plot the variable "err", you'll have a practical demo
of the interpolation error. in this test, a sinusoid is shifted first
with this code and second using the exact expression. the two
are then compared. the third test is a similar test for random noise.

I am not sure how to document that in the help message since
the value of log10_rejection is hard wired. A note in the code
might be a better idea?

> seems like a good thing. I'd say go ahead and commit it.

OK, done with the change in the copyright/help
but I have a problem here. I could svn add the source but
svn refuses to commit (see message which I don't understand).
right access problem? am I missing something?

octave-forge/main/signal/inst$ svn status
A      fracshift.m
octave-forge/main/signal/inst$ svn ci fracshift.m -m"first import"
svn: Commit failed (details follow):
svn: Server sent unexpected return value (403 Forbidden) in response to MKACTIVITY request for '/svnroot/octave/!svn/act/d893d539-3913-4ddc-ada4-448b62242a57'

eric

Re: shift of a fractional number of samples

by David Bateman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Chassande-Mottin wrote:

>> Cute, and I can see the use of such a function for clock offset
> calculations in comms systems. I
>> typically use simpler narrwband approximations for this functionality as I
>> have to worry about how
>> to implement it on an ASIC.
>
> good to know that this work could be useful elsewhere!
>
>> The interpolator must introduce a colored noise to the signal, that
>> depends on the signal given to
>> the function, and the characteristics of the interpolating filter. Have
>> you any idea of the magnitude
>> of the error introduced with the default filter? If so it would probably
>> makes sense to document it in
>> the help string so that others kno what to expect. I'd check myself, but
>> am writing from an EEE PC
>> without a copy of Octave installed to check with.
>
> the parameter log10_rejection determines the interpolation error in
> the working band of the interpolator. if you make a script with the
> first test and plot the variable "err", you'll have a practical demo
> of the interpolation error. in this test, a sinusoid is shifted first
> with this code and second using the exact expression. the two
> are then compared. the third test is a similar test for random noise.

Can't this be a parameter of the function? Say if the third argument is
a vector it is treated as the interpolator, and if its a scalar its
treated as the rejection. The log10_rejection default value is -3,
though it seems that is later multiplied by -20 to give a 60dB
rejection. Why just have the value to 60 instead?

>
> I am not sure how to document that in the help message since
> the value of log10_rejection is hard wired. A note in the code
> might be a better idea?

If the above change is acceptable then why not something like

## -*- texinfo -*-
## @deftypefn {Function File} {[@var{y}, @var{h}] =} fracshift (@var{x},
@var{d})
## @deftypefn {Function File} {[@var{y}, @var{h}] =} fracshift (@var{x},
@var{d}, @var{rej})
## @deftypefnx {Function File} {@var{y} =} fracshift (@var{x}, @var{d},
@var{h})
## Shift the series @var{x} by a (possibly fractional) number of samples
## @var{d}.
##
## If the third argument @var{h} is a vector it defines the interpolator,
## otherwise the interpolator is constructed with a Kaiser-windowed sincard.
## The acceptable error of the window function is determined by @var{rej},
## which by default is 60, representing an acceptable error in the
## interpolation of -60dB. If the third argument is scalar then it
determines
## this rejection.
## @end deftypefn
## @seealso{circshift}

>
>> seems like a good thing. I'd say go ahead and commit it.
>
> OK, done with the change in the copyright/help
> but I have a problem here. I could svn add the source but
> svn refuses to commit (see message which I don't understand).
> right access problem? am I missing something?
>
> octave-forge/main/signal/inst$ svn status
> A      fracshift.m
> octave-forge/main/signal/inst$ svn ci fracshift.m -m"first import"
> svn: Commit failed (details follow):
> svn: Server sent unexpected return value (403 Forbidden) in response to
> MKACTIVITY request for
> '/svnroot/octave/!svn/act/d893d539-3913-4ddc-ada4-448b62242a57'
>
> eric

Not sure of the reason. Probably a transient issue with sourceforge.
Give it a few hours then try again..

D.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: shift of a fractional number of samples

by Raymond E. Rogers-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

dbateman wrote:

>
> Eric Chassande-Mottin wrote:
>  
>> I have written a function (
>> http://www.nabble.com/file/p18490379/fracshift.m code attached,
>> fracshift.m ) which performs the shift of a data vector
>> (e.g., a time-series) by a fractional number of samples. this is useful
>> in area such as antenna array processing and possibly
>> others (processing of stereo audio signals?). It is fairly
>> well documented, has the GPL and include three sanity checks.
>>
>>    
>
> Cute, and I can see the use of such a function for clock offset calculations
> in comms systems. I typically use simpler narrwband approximations for this
> functionality as I have to worry about how to implement it on an ASIC.
>
> The interpolator must introduce a colored noise to the signal, that depends
> on the signal given to the function, and the characteristics of the
> interpolating filter. Have you any idea of the magnitude of the error
> introduced with the default filter? If so it would probably makes sense to
> document it in the help string so that others kno what to expect. I'd check
> myself, but am writing from an EEE PC without a copy of Octave installed to
> check with.
>
> A couple of comments on the code itself, could you move the copyright to
> above the function definition, and the help text immediately following it
> with a single blank line between the copyright and the help text. This will
> be more consistent with the rest of Octave.
>
>
>
>  
>> As far as I know, there is no equivalent in the matlab world.
>> I would fit in the signal toolbox. Would you agree if I include it
>> there?
>>
>>    
>
>  
I think it should be added, but I would like to know it's different from
"resampling".  From
http://www.dspguru.com/info/faqs/multrate/resamp.htm


        4.1.1 What is "resampling"?

    "Resampling" means combining interpolation and decimation to change
    the sampling rate by a rational factor.

RayR

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: shift of a fractional number of samples

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Raymond E. Rogers wrote:

> I think it should be added, but I would like to know it's different
> from "resampling".  From
> http://www.dspguru.com/info/faqs/multrate/resamp.htm
>
>
>        4.1.1 What is "resampling"?
>
>    "Resampling" means combining interpolation and decimation to change
>    the sampling rate by a rational factor.
>
> RayR


Although related to resampling, this is not resampling as the same clock
rate is maintained. What is done instead is an offset in the sampling,
which for example might represent a timing offset in the samples
relative to an ideal sampling times.

D.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: shift of a fractional number of samples

by Eric Chassande-Mottin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


fracshift is committed with the change you suggested.

> I think it should be added, but I would like to know it's different
> from "resampling".  From
> http://www.dspguru.com/info/faqs/multrate/resamp.htm

the reference that I give in the source is a good starting point
to understand the relationships between resampling and fractional
sample shifting.

## Ref [2] T.I. Laakso, V. Valimaki, M. Karjalainen and U.K. Laine
## Splitting the unit delay, IEEE Signal Processing Magazine,
## vol. 13, no. 1, pp 30--59 Jan 1996

eric.
LightInTheBox - Buy quality products at wholesale price