Hello all,

From what I understand of fast Fourier transforms, fftshift and ifftshift should be almost identical. The only difference is when there are an odd number of elements in the dimension along which the shift is performed (ie fftshift([1:4])==ifftshift([1:4]) but fftshift([1:5])!=ifftshift([1:5])). However, it seems that in scilab6.x fftshift and ifftshift are based on completely different codes and do not accept the same arguments. In particular, with fftshift, one can specify the dimension along which to perform the shift, while it is not the case for ifftshift.
I think some update of ifftshift would be welcome.
I propose to use the code below (myifftshift), where I just changed "ceil" by "floor" in the definition if fftshift.
What do you think, does it look right to you?

Cheers,

Antoine

function x = myifftshift(x,job)
    if argn(2)<2 then job="all",end
    deff("sel=fun(sk)","c=floor(sk/2);sel=[c+1:sk,1:c]")
    if job=="r" then job=1,elseif job=="c" then job=2,end
    ind=list()
    if job=="all" then
        for sk=size(x),ind($+1)=fun(sk),end
    else
        for sk=size(x),ind($+1)=:,end;
        ind(job)=fun(size(x,job))
    end
    x=x(ind(:))
endfunction

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to