0
$\begingroup$

I know about using fitering(e.g. window filters that used in frequency domain), wavelets for decreasing or even full eliminating gibbs effect but don't really understand how we can use window functions in time-domain for this. Although I know that usually windows should used for decreasing spectral leakage.

For a test heavised function with gibbs effect was created. I tried using blackmanharris window with overlap about ~2/3(i read in some article that it's the best value) but it gets muuch worse with that. Playing with window size and overlap coefficient doesn't help at all. What am i missing or doing wrong?

Loaded plot picture(Blue - original heaviside jump with gibbs phenomenon, orange - windowed result): Blue - original heaviside jump with gibbs phenomenon, orange - windowed result

Code:

pkg load signal

A=-5; h=0.01; B=5; p=0.6; #p - value of spectrum cut
x=A:h:B;
N=max(size(x));
y=x;
y(y>=0)=1;
y(y<0)=0;
spectr=fftshift(fft(y));
spectr(1:1+round(N/2-N/2*(1-p)))=0;
spectr(round(N/2+N/2*(1-p)):end)=0;
spectr=ifftshift(spectr);
intrp=real(ifft(spectr));
#figure; plot(x,intrp);

#init parameters
w_size=32;
overlap=0.61;

add=round(w_size*(1-overlap));
W=blackmanharris(w_size)';
Final=zeros(1,N);
b=1;
e=b+w_size-1;

  borders=[];
while (e<N)
  y=intrp(b:e).*W;
  z=Final(b:e);
  Final(b:e)=Final(b:e)+y;
  borders=[borders A+b*h];
  b=b+add;
  e=e+add;
endwhile
e=N-1;
y=intrp(b:e).*W(1:e-b+1);
Final(b:e)=Final(b:e)+y;
#main graphs
figure; plot(x,intrp);
hold on; plot(x,Final);
z=zeros(1,max(size(borders)));
hold on; plot(borders,z,"."); 
$\endgroup$
7
  • $\begingroup$ Welcome to the forum. If possible for you try Fejér kernel. en.wikipedia.org/wiki/Fej%C3%A9r_kernel $\endgroup$
    – Juha P
    Commented Oct 20, 2023 at 7:13
  • $\begingroup$ Catalog of Window Taper Functions for Sidelobe Control $\endgroup$
    – Juha P
    Commented Oct 20, 2023 at 7:19
  • $\begingroup$ Hello! Thank you for the idea. I have tried Fejer kernel just now and it showed me quite same result, quick oscillations on the second upper half of signal and no reduction of gibbs effect :( , i tried many combitanions of overlap and window fejer size too. Seems like i'm doing something wrong $\endgroup$
    – Alexander
    Commented Oct 20, 2023 at 23:21
  • $\begingroup$ Yes, it does not eliminate the Gibb's effect but just halves the effect: desmos.com/calculator/lxfnjwvmdc . Maybe you have some issues with the code. $\endgroup$
    – Juha P
    Commented Oct 21, 2023 at 11:22
  • $\begingroup$ Ohhh... thank you, i see it now!!!!! But could i ask how you get y_fejer from y? As i understand y_fejer=y*w_fejer => w_fejer=? It's just expressions with fourier series so i can't really derive the formula. Is it just the same as from wiki? $\endgroup$
    – Alexander
    Commented Oct 22, 2023 at 16:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.