[Scilab-users] Padding and clipping a grid

Samuel Gougeon sgougeon at free.fr
Sun Jul 29 14:04:07 CEST 2018


Le 29/07/2018 à 13:56, Samuel Gougeon a écrit :
> Hello Lester,
>
> Le 29/07/2018 à 13:18, arctica1963 a écrit :
>> Hello all,
>>
>> I need to increase the dimensions over which the FFT is calculated to 
>> avoid
>> edge effects,
>
> AFAIK, padding the initial signal does not avoid edge effects (i guess 
> one deal with edges discontinuity).
> It can even be the source of discontinuity, and so yield fake high fft 
> amplitudes at high frequencies.
> It will be the case if  the original signal S has no edge 
> discontinuity ( S(1)~S($)) but you padd
> it with zeros while its edge does not fall to zeros (=> |S($)|>>0, 
> S($+1)==0). Even worse,
> in this case, windowing the signal will no longer be effective, since 
> the padding will move
> the discontinuity in the body of the padded signal instead of on 
> signal's edge.
>
> Padding a signal increases the lowest frequency of its numerical FT, 
> that is the sampling frequency
> of its FFT. AFAIUnderstand, there is no edge matter there.
>
> But this is more a signal processing topic than a Scilab one.

Le 29/07/2018 à 13:18, arctica1963 a écrit :
> Hello all,
>
> I need to increase the dimensions over which the FFT is calculated to avoid
> edge effects, and following the suggestion of Samuel Gougeon back in 2016,
> this was recommended:
>
> Scilab: 6.0.1
>
> data = [1 2 3; 4 5 6; 7 8 9]
> addedRows = 3; addedCols = 3;
>
> tmp = [data ; data($, :) .*. ones(addedRows, 1)]; // add rows to bottom
> tmp = [tmp  tmp(:, $) .*. ones(1,addedCols)]; // add columns to right
> tmp = [repmat(tmp(1, : ), addedRows, 1) ; tmp]; // add rows to top
> paddedMat = [repmat(tmp(:,1) , 1, addedCols) tmp] // add columns to left

--> paddedMat = [repmat(tmp(:,1) , 1, addedCols) tmp] // add columns to left
  paddedMat  =

    1.   1.   1.   1.   2.   3.   3.   3.   3.
    1.   1.   1.   1.   2.   3.   3.   3.   3.
    1.   1.   1.   1.   2.   3.   3.   3.   3.
    1.   1.   1.   1.   2.   3.   3.   3.   3.
    4.   4.   4.   4.   5.   6.   6.   6.   6.
    7.   7.   7.   7.   8.   9.   9.   9.   9.
    7.   7.   7.   7.   8.   9.   9.   9.   9.
    7.   7.   7.   7.   8.   9.   9.   9.   9.
    7.   7.   7.   7.   8.   9.   9.   9.   9.

OK: here the padding is not done with zeros. Sorry for my misunderstanding.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180729/d3ee1aac/attachment.htm>


More information about the users mailing list