What is the limit on the number of indices in a hanning window?

Hello,

i’m trying to apply a Hanning window to a 1e6 sample signal:

N=1e6;
hwin=hann(N);
nvolts=hwin*volts(1:N)

I get the following error:
error: out of memory or dimension too large for Octave's index type

However,

x=hann(1e6)

works fine, although I cannot plot it.

plot(x) 

returns a blank plot. However

plot(hann(1e5))

works fine. Am I really hitting an indexing limit in Octave or is this some other bug? Or- am I doing something wrong?

nvolts is probably NxN matrix. If you want to use element-by-element multiplication (to get 1xN vector)
you need to use “.*” operator and they are both of the same orientation. Also if by “apply” you mean “filter time series volts by Hanning filter” you doing it wrong (see “help conv”).

octave:32> a=(1:3)'
a =

   1
   2
   3

octave:33> b=ones(1,3)
b =

   1   1   1

octave:34> a*b
ans =

   1   1   1
   2   2   2
   3   3   3

octave:35> a.*b
ans =

   1   1   1
   2   2   2
   3   3   3

octave:36> a.*b'
ans =

   1
   2
   3

octave:37> a' .*b
ans =

   1   2   3

octave:38> b * a
ans = 6

WRT plotting – this might be a separate issue. What OS and octave release are you using?
octave’s command “ver” gives some useful info.
It works for me on linux with octave 7.1 pre-release:

ctave:40> N=1e6;
hwin=hann(N);
octave:42> whos hwin
Variables visible from the current scope:

variables in scope: top scope

  Attr   Name         Size                     Bytes  Class
  ====   ====         ====                     =====  ===== 
         hwin   1000000x1                    8000000  double

Total is 1000000 elements using 8000000 bytes

octave:43> volts = randn(1e6,1);
octave:44> plot(volts)
octave:45> nvolts=hwin .* volts ;
octave:46> hold on
octave:47> plot(nvolts)
octave:48> version
ans = 7.0.91
octave:49> ver
----------------------------------------------------------------------
GNU Octave Version: 7.0.91 (hg id: fc530ec01070)
GNU Octave License: GNU General Public License
Operating System: Linux 5.16.9-200.fc35.x86_64 #1 SMP PREEMPT Fri Feb 11 16:29:17 UTC 2022 x86_64
----------------------------------------------------------------------

Plot is attached.

thank you.

w.r.t to “applying the window” --this is done in the time domain. Thus, the samples are multiplied by the window coefficients in the time domain. It is not convolution in the time domain.