This file is indexed.

/usr/share/octave/packages/signal-1.3.2/movingrms.m is in octave-signal 1.3.2-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
## Copyright (c) 2012 Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn {Function File} {[@var{rmsx},@var{w}] =} movingrms (@var{x},@var{w},@var{rc},@var{Fs}=1)
## Calculate moving RMS value of the signal in @var{x}.
##
## The signal is convoluted against a sigmoid window of width @var{w} and
## risetime @var{rc}. The units of these parameters are relative to the value
## of the sampling frequency given in @var{Fs} (Default value = 1).
##
## Run @code{demo movingrms} to see an example.
##
## @seealso{sigmoid_train}
## @end deftypefn

function [rmsx w]= movingrms (x,width, risetime, Fs=1)

  [N nc] = size (x);
  if width*Fs > N/2
    idx = [1 N];
    w    = ones(N,1);
  else
    idx   = round ((N + width*Fs*[-1 1])/2);
    w     = sigmoid_train ((1:N)', idx, risetime*Fs);
  endif
  fw    = fft (w.^2);
  fx    = fft (x.^2);
  rmsx  = real(ifft (fx.*fw)/(N-1));

  rmsx (rmsx < eps*max(rmsx(:))) = 0;

  rmsx  = circshift (sqrt (rmsx), round(mean(idx)));
  ##w     = circshift (w, -idx(1));

endfunction

%!demo
%! N = 128;
%! t = linspace(0,1,N)';
%! x = sigmoid_train (t,[0.4 inf],1e-2).*(2*rand(size(t))-1);
%!
%! Fs    = 1/diff(t(1:2));
%! width = 0.05;
%! rc = 5e-3;
%! [wx w] = movingrms (zscore (x),width,rc,Fs);
%!
%! close all
%! figure ()
%!
%! area (t,wx,'facecolor',[0.85 0.85 1],'edgecolor','b','linewidth',2);
%! hold on;
%! h = plot (t,x,'r-;Data;',t,w,'g-;Window;');
%! set (h, 'linewidth', 2);
%! hold off
%!
%! # ---------------------------------------------------------------------------
%! # The shaded plot shows the local RMS of the Data: white noise with onset at
%! # aprox. t== 0.4.
%! # The observation window is also shown.

%!demo
%! N = 128;
%! t = linspace(0,1,N)';
%! x = exp(-((t-0.5)/0.1).^2) + 0.1*rand(N,1);
%!
%! Fs    = 1/diff(t(1:2));
%! width = 0.1;
%! rc = 2e-3;
%! [wx w] = movingrms (zscore (x),width,rc,Fs);
%!
%! close all
%! figure ()
%!
%! area (t,wx,'facecolor',[0.85 0.85 1],'edgecolor','b','linewidth',2);
%! hold on;
%! h = plot (t,x,'r-;Data;',t,w,'g-;Window;');
%! set (h, 'linewidth', 2);
%! hold off
%!
%! # ---------------------------------------------------------------------------
%! # The shaded plot shows the local RMS of the Data: Gausian with centered at
%! # aprox. t== 0.5.
%! # The observation window is also shown.