user5897928 February 2016
### Not able to perform frequency domain windowing correctly?

I am trying to perform a frequency domain windowing by convolving a sinc signal (in blue color) with the impulse response of a raise cosine window (1+0.5*cos()).

I have attached a code for the same below. Any help would be highly appreciated.

```
n0=0;
w=0.5;
N=64;
Ncap=5*N;
L=Ncap/N;
n=(-Ncap/2:(Ncap/2)-1);
Ws=N/Ncap;
s=sinc(Ws.*(n+n0));
test_FIR=[0.5 0 0 0 0 1 0 0 0 0 0.5];
conv_out= (conv(test_FIR,s)/max(conv(s,test_FIR)));
figure(2)
plot(s,)
hold on
plot(conv_out,'k','LineWidth',2)
```

For the way you proceed, the result is expected. What you're plotting is `s`

(which has 320 doubles) along with `conv_out`

, which has 330 elements (because the convolution's result is going to have one less than the sum of number of elements per vectors that you convolve, i.e. 320 and 11).

Since you're plotting both vectors against the position of the elements, is quite normal that the `conv_out`

is shifted compared to `s`

(because they have different lengths). What you need is to correctly choose the x axis for plotting. So, try to figure what is the correct x axis.

Asked in February 2016

Viewed 2,249 times

Voted 12

Answered 1 times

Viewed 2,249 times

Voted 12

Answered 1 times