<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello Rafael,<br>
      <br>
      I did not remember this symetrization trick that you use to
      restore continuous boundaries and so avoid the noise-making jump.<br>
      It is very efficient. Great!<br>
      <br>
      I don't see any reason that could make this trick failing with
      complex numbers:<br>
      Making the signal even makes its spectrum even, whatever is the
      signal, real or complex.<br>
      So, the very same algorithm shall work as well for complex data.<br>
      <br>
      Extension to N-Dimension should be OK as well with the fft(., .,
      selection) syntax, and a loop other the selected direction.<br>
      <br>
      May be because the slope is still discontinuous, there is still a
      tiny artefact after shifting.<br>
      This may invite to still try with a damping window, in comparison
      with the symetrization.<br>
      Damping makes the signal and its derivative continuous across
      limits.<br>
      <br>
      I am answering to your next message by replying to it.<br>
      <br>
      Best regards<br>
      Samuel<br>
      <br>
      Le 01/06/2018 à 17:56, Rafael Guerra a écrit :<br>
    </div>
    <blockquote
cite="mid:DB7PR04MB41076C4B7740EB35E2E621E9CC620@DB7PR04MB4107.eurprd04.prod.outlook.com"
      type="cite">
      <pre wrap="">Hi Samuel,

The implementation below of the circular fractional shift function seems to suffer from less endpoints’ artefacts.

// START OF CODE
// Circular fractional shift (R.Guerra, 01-Jun-2018)

function v=cfshift(y, s)
    // y: 1D series of real values
    // s: shift, decimal number of samples
    // v: y series shifted by s samples
    N0 = length(y);
    y2 = [y y($:-1:1)]; // make input even and continuous
    N = length(y2);
    m = N/2;
    dw = -%i*2*%pi/N;
    ix1 = 1:m;
    ix = [0, ix1, -ix1(m-1:-1:1)];
    s = modulo(s,N0);
    lph = exp(ix*dw*s);
    v0 = real((ifft(fft(y2).*lph)));
    n0 = floor(s);
    if n0>=0 then
       v = [v0(N0+1:N0+n0) v0(n0+1:N0)];
    else
       v = [v0(1:N0+n0) v0(N+n0+1:N)];
    end
endfunction

clf
n = 30;  // number of input samples
x = 1:n;  // domain of the series, with unit sampling rate
sn = -33;  // ex.1: negative integer shift (modulo(sn,n) = -3)
sp = 10.5; // ex.2: positive fractional shift
y = cos(1.8*%pi*(x-10)/n); // ex. of input series with discontinuous at endpoints
vi = cfshift(y, sn);  
vf = cfshift(y, sp);
plot(x,y,'blacko',x,y,'black--',x,vi,'bo',x,vi,'b--',x,vf,'ro',x,vf,'r--');
xgrid
title("Original series with circular integer shift = " + string(sn) + " (blue) and circular fractional shift = " + string(sp) +" (red)", "fontsize",4);
gca().data_bounds = [0.5,-1.1;n+0.5,1.1]
gca().tight_limits="on";

// END OF CODE


Not sure if this is the best way to implement this.
Also, it requires generalization to complex numbers and multi-dimensions.

Regards,
Rafael
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>