2
$\begingroup$

How the input signal get multiplied with the window functions like Hamming, Hanning, Blackman, etc?

I have tried to multiply the input signal of $10\textrm{ MHz}$ sampled at $100\textrm{ MHz}$ using the Blackmann window function. The output graph is enter image description here

  • How is the multiplication perfomed ?

The input signal is $1\times 64$ row matrix, the Blackman window generates its samples in $64\times 1$ column matrix. The multiplication generates a $64\times 64$ matrix i.e one sample of input signal is multiplied to 64 samples of the window function. For a particular point sample there are 64 sample value. I intend to calculate 128-point FFT with padding zeros.

  • So for a particular sample point which value should be considered to calculate FFT?

Here is my code :

N = 64; % signal length (power of 2)
T = 10*(10^-9) ; % sampling period (and rate) is set to 1
A = 1; % sinusoid amplitude
phi = 0; % phase of zero
f = 10*(10^6); % frequency (under Nyquist limit)
nT = [0:N-1]*T; % discrete time axis
w = blackman(N,'periodic');
x1 = A*cos(2*pi*f*nT);
x = w*x1  ; % windowed signal
subplot (311);
stem (x1);
wp = [w;zeros((zpf-1)*N,1)];
subplot (313);
stem (x);
subplot (312);
stem (w);
disp (x1);
disp (w);
disp (x);
$\endgroup$
  • $\begingroup$ Welcome to SE.DSP! You appear to have done the right thing. What do you think is wrong? Please edit your question with the extra information. $\endgroup$ – Peter K. Jul 25 '17 at 12:48
  • $\begingroup$ I would say his problem is that he wanted to obtain his original signal weighted by the window, but instead he is obtaining a set of signals corresponding to his window function weighted by each sample of his signal. In my opinion it's just a problem of Matlab code, he did a matrix product instead of a dotted product. $\endgroup$ – Florent Jul 25 '17 at 23:46
  • $\begingroup$ Husain Asif : you should post your code, I'm pretty sure it's just a simple syntax issue $\endgroup$ – Florent Jul 25 '17 at 23:46
  • 1
    $\begingroup$ @HusainAsif with a dot... A .* B. As said earlier, post your code if you want more than guesses. source $\endgroup$ – Florent Jul 26 '17 at 4:42
  • 1
    $\begingroup$ not here, in your question, with proper formatting please. $\endgroup$ – Florent Jul 26 '17 at 4:51
1
$\begingroup$

Matlab window functions such as hamming(N) returns the $N$ point Hamming window sequence $w[n]$ in a $N \times 1$ matrix (a column vector).

Therefore if your sequence $x[n]$ is represented in a row vector of size $1 \times N$ then for obtaining the sample-by-sample product $x[n]w[n]$, you should either transpose $w[n]$ or the other $x[n]$, so that their dimensions permit the correct sample-by-sample multiplication in between and produce the output sequence $v[n]=w[n]x[n]$ represented in a matrix of the size $N \times 1$ or $1 \times N$ depending on which one you have transposed.

v0 = x.*w      % x: Nx1, w: Nx1, v0: Nx1
v1 = x .* w'   % x: 1xN, w: Nx1, transpose w => v1: 1xN
v3 = x' .* w   % x: 1xN, w: Nx1, transpose x => v3: Nx1

Note that if the transposed signal is complex valued, then you should use the conjugate transpose instead :

v1 = conj(x').* w  % x[n] was complex valued...

Note also that the sample by sample product is perfomed by the $.*$ operation under Matlab;

  v = x .* w    % is a sample by sample product implementing v[n] = x[n]w[n]

If you omit the period and use the $*$ alone, you get matrix product or the dot product in case of vectors involved.

For this case when you have two vectors, $x$ of size $N \times 1$ and $w$ of size $1 \times N$, then their matrix product would produce a matrix of size $N \times N$

v = x * w    % x: N x 1, w: 1 x N => v: N x N
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.