<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Rafael,<br>
      <br>
      To me, this attempt looks not legitimate.<br>
      Indeed, the true original signal HAS a steep jump across its
      edges.<br>
      So, the best algorithm should  shift the signal and <b>keep this
        big slope</b><b><br>
      </b><b>from one sample to the next</b>. The jump is <i><b>at
          least</b></i> as steep as from<br>
      one sample to the next (and likely steeper). It must not be
      broadened.<br>
      There is no reason to interpolate and then decrease the slope.<br>
      Is there?<br>
      <br>
      IMO, hybridating DFT and interpolation is not promising, and<br>
      DFT looks more powerful. So, to me, now the question is mainly:<br>
      with symetrization, versus with damping.<br>
      <br>
      Read you soon<br>
      Samuel<br>
      <br>
      Le 02/06/2018 à 15:23, Rafael Guerra a écrit :<br>
    </div>
    <blockquote
cite="mid:VI1PR04MB41098A0550A3B8E9618F00DECC610@VI1PR04MB4109.eurprd04.prod.outlook.com"
      type="cite">
      <pre wrap="">
The previous fractional shift code was still not handling properly the endpoints.
Herein an improvement.
Fourier is still used but the sample laying between end and start points is interpolated.

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

function v=cfshift(y, s)
    // y: 1D series 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);
    xi = s - n0;
    yi = y(1) + xi*(y($)-y(1)); //interpolates sample between end and start
    if n0>=0 then
       v = [v0(N0+1:N0+n0) yi v0(n0+2:N0)];
    else
       v = [v0(1:N0+n0) yi v0(N+n0+2: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); // input series, 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 (black), 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

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>