Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package octave-forge-signal for
openSUSE:Factory checked in at 2022-07-19 17:19:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-signal (Old)
and /work/SRC/openSUSE:Factory/.octave-forge-signal.new.1523 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "octave-forge-signal"
Tue Jul 19 17:19:16 2022 rev:5 rq:989579 version:1.4.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/octave-forge-signal/octave-forge-signal.changes
2019-11-28 10:15:20.791637912 +0100
+++
/work/SRC/openSUSE:Factory/.octave-forge-signal.new.1523/octave-forge-signal.changes
2022-07-19 17:19:17.336360804 +0200
@@ -1,0 +2,13 @@
+Fri May 6 18:14:43 UTC 2022 - Atri Bhattacharya <[email protected]>
+
+- Update to version 1.4.2:
+ * The compiled functions have been made compatible with recent
+ changes in the development version of Octave.
+ * Minor bug fixes and documentation improvements have been made
+ to the following functions: cplxreal, cheb2ap, buffer,
+ data2fun, ss2zp, clustersegmen ncauer, cohere, csd, pburg,
+ pwelch, pyulear, tfe, invfreq, invfreqs, invfreqz, upfirdn.
+ * The following new functions have been added to the signal
+ package: sos2ss.
+
+-------------------------------------------------------------------
Old:
----
signal-1.4.1.tar.gz
New:
----
signal-1.4.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ octave-forge-signal.spec ++++++
--- /var/tmp/diff_new_pack.oWNBIe/_old 2022-07-19 17:19:17.788361407 +0200
+++ /var/tmp/diff_new_pack.oWNBIe/_new 2022-07-19 17:19:17.792361412 +0200
@@ -1,7 +1,7 @@
#
# spec file for package octave-forge-signal
#
-# Copyright (c) 2019 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%define octpkg signal
Name: octave-forge-%{octpkg}
-Version: 1.4.1
+Version: 1.4.2
Release: 0
Summary: Signal processing tools for Octave
License: GPL-3.0-or-later AND SUSE-Public-Domain
++++++ signal-1.4.1.tar.gz -> signal-1.4.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/DESCRIPTION new/signal-1.4.2/DESCRIPTION
--- old/signal-1.4.1/DESCRIPTION 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/DESCRIPTION 2022-04-23 13:21:25.000000000 +0200
@@ -1,6 +1,6 @@
Name: signal
-Version: 1.4.1
-Date: 2019-02-08
+Version: 1.4.2
+Date: 2022-04-22
Author: various authors
Maintainer: Mike Miller <[email protected]>
Title: Signal Processing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/INDEX new/signal-1.4.2/INDEX
--- old/signal-1.4.1/INDEX 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/INDEX 2022-04-23 13:21:25.000000000 +0200
@@ -52,6 +52,7 @@
polystab
residued
residuez
+ sos2ss
sos2tf
sos2zp
ss2tf
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/NEWS new/signal-1.4.2/NEWS
--- old/signal-1.4.1/NEWS 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/NEWS 2022-04-23 13:21:25.000000000 +0200
@@ -1,3 +1,24 @@
+Summary of important user-visible changes for signal 1.4.2:
+----------------------------------------------------------
+
+ ** The compiled functions have been made compatible with recent changes in
+ the development version of Octave.
+
+ ** Minor bug fixes and documentation improvements have been made to the
+ following functions:
+
+ cplxreal cheb2ap buffer
+ data2fun ss2zp clustersegmen
+ ncauer cohere csd
+ pburg pwelch pyulear
+ tfe invfreq invfreqs
+ invfreqz upfirdn
+
+ ** The following new functions have been added to the signal package:
+
+ sos2ss
+
+
Summary of important user-visible changes for signal 1.4.1:
----------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/buffer.m
new/signal-1.4.2/inst/buffer.m
--- old/signal-1.4.1/inst/buffer.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/buffer.m 2022-04-23 13:21:25.000000000 +0200
@@ -1,4 +1,4 @@
-## Copyright (C) 2008 David Bateman <[email protected]>
+## Copyright (C) 2008-2022 David Bateman <[email protected]>
##
## 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
@@ -120,7 +120,7 @@
endwhile
[i, j] = ind2sub([n-p, m], l);
if (all ([i, j] == [n-p, m]))
- off --;
+ off--;
endif
y (:, end - off + 2 : end) = [];
else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/cheb2ap.m
new/signal-1.4.2/inst/cheb2ap.m
--- old/signal-1.4.1/inst/cheb2ap.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/cheb2ap.m 2022-04-23 13:21:25.000000000 +0200
@@ -21,10 +21,15 @@
## This function exists for @sc{matlab} compatibility only, and is equivalent
## to @code{cheby2 (@var{n}, @var{Rs}, 1, "s")}.
##
+## Demo
+## @example
+## demo cheb2ap
+## @end example
+##
## @seealso{cheby2}
## @end deftypefn
-function [z, p, g] = cheb2ap (n, Rp)
+function [z, p, g] = cheb2ap (n, Rs)
if (nargin != 2)
print_usage();
@@ -36,3 +41,17 @@
[z, p, g] = cheby2 (n, Rs, 1, "s");
endfunction
+%!error <N must> cheb2ap (-1, 3)
+%!error <RS must> cheb2ap (3, -1)
+
+#From Steven T. Karris "Signals and Systems Second Edition" [pg. 11-36]
+%!demo
+%! w=0:0.01:1000;
+%! [z, p, k] = cheb2ap (3, 3);
+%! [b, a] = zp2tf (z, p, k);
+%! Gs = freqs (b, a, w);
+%! semilogx (w, abs (Gs));
+%! xlabel('Frequency in rad/sec')
+%! ylabel('Magnitude of G(s)');
+%! title('Type 2 Chebyshev Low-Pass Filter, k=3, 3 dB ripple in stop band')
+%! grid;
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/clustersegment.m
new/signal-1.4.2/inst/clustersegment.m
--- old/signal-1.4.1/inst/clustersegment.m 2019-02-08 23:00:37.000000000
+0100
+++ new/signal-1.4.2/inst/clustersegment.m 2022-04-23 13:21:25.000000000
+0200
@@ -1,4 +1,4 @@
-## Copyright (C) 2010 Juan Pablo Carbajal <[email protected]>
+## Copyright (C) 2021 Juan Pablo Carbajal
##
## 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
@@ -37,18 +37,18 @@
function contRange = clustersegment(xhi)
## Find discontinuities
- bool_discon = diff(xhi,1,2);
- [Np Na] = size(xhi);
- contRange = cell(1,Np);
+ bool_discon = diff (xhi, 1, 2);
+ [Np Na] = size (xhi);
+ contRange = cell (1, Np);
for i = 1:Np
- idxUp = find(bool_discon(i,:)>0)+1;
- idxDwn = find(bool_discon(i,:)<0);
- tLen = length(idxUp) + length(idxDwn);
+ idxUp = find (bool_discon(i,:) > 0) + 1;
+ idxDwn = find (bool_discon(i,:) < 0);
+ tLen = length (idxUp) + length (idxDwn);
- if xhi(i,1)==1
+ if xhi(i,1) == 1
## first event was down
- contRange{i}(1) = 1;
+ contRange{i}(1) = 1;
contRange{i}(2:2:tLen+1) = idxDwn;
contRange{i}(3:2:tLen+1) = idxUp;
else
@@ -57,14 +57,14 @@
contRange{i}(2:2:tLen) = idxDwn;
endif
- if xhi(i,end)==1
+ if xhi(i,end) == 1
## last event was up
contRange{i}(end+1) = Na;
endif
- tLen = length(contRange{i});
- if tLen ~=0
- contRange{i}=reshape(contRange{i},2,tLen/2);
+ tLen = length (contRange{i});
+ if tLen ~= 0
+ contRange{i} = reshape (contRange{i}, 2, tLen / 2);
endif
endfor
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/cohere.m
new/signal-1.4.2/inst/cohere.m
--- old/signal-1.4.1/inst/cohere.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/cohere.m 2022-04-23 13:21:25.000000000 +0200
@@ -14,15 +14,17 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## Usage:
-## [Pxx,freq] = cohere(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{Pxx}, @var{freq}]} =
cohere(@var{x},@var{y},@var{Nfft},@var{Fs},@var{window},@var{overlap},@var{range},@var{plot_type},@var{detrend})
+## Estimate (mean square) coherence of signals "x" and "y".
##
-## Estimate (mean square) coherence of signals "x" and "y".
-## Use the Welch (1967) periodogram/FFT method.
-## Compatible with Matlab R11 cohere and earlier.
-## See "help pwelch" for description of arguments, hints and references
-## --- especially hint (7) for Matlab R11 defaults.
+## Use the Welch (1967) periodogram/FFT method.
##
+## Compatible with Matlab R11 cohere and earlier.
+##
+## See "help pwelch" for description of arguments, hints and references
+## --- especially hint (7) for Matlab R11 defaults.
+## @end deftypefn
function varargout = cohere(varargin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/cplxreal.m
new/signal-1.4.2/inst/cplxreal.m
--- old/signal-1.4.1/inst/cplxreal.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/cplxreal.m 2022-04-23 13:21:25.000000000 +0200
@@ -67,7 +67,7 @@
nz = length (z);
idx = nz;
- while ((idx > 0) && ((abs (imag (zcp(idx))) ./ abs (zcp(idx))) <= tol))
+ while ((idx > 0) && (zcp(idx) == 0 || (abs (imag (zcp(idx))) ./ abs
(zcp(idx))) <= tol))
zcp(idx) = real (zcp(idx));
idx--;
endwhile
@@ -98,6 +98,18 @@
%! assert (zc, complex (0.5, sin (pi/3)), 10*eps)
%! assert (zr, -1, 2*eps)
+## Test with 2 real zeros, one of them equal to 0
+%!test
+%! [zc, zr] = cplxreal (roots ([1, 0, 0, 1, 0]));
+%! assert (zc, complex (0.5, sin (pi/3)), 10*eps)
+%! assert (zr, [-1; 0], 2*eps)
+
+## Test with 3 real zeros, two of them equal to 0
+%!test
+%! [zc, zr] = cplxreal (roots ([1, 0, 0, 1, 0, 0]));
+%! assert (zc, complex (0.5, sin (pi/3)), 10*eps)
+%! assert (zr, [-1; 0; 0], 2*eps)
+
## Test input validation
%!error cplxreal ()
%!error cplxreal (1, 2, 3, 4)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/csd.m new/signal-1.4.2/inst/csd.m
--- old/signal-1.4.1/inst/csd.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/csd.m 2022-04-23 13:21:25.000000000 +0200
@@ -14,13 +14,16 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## Usage:
-## [Pxx,freq] = csd(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{Pxx},@var{freq}]} = csd(@var{x}, @var{y},
@var{Nfft}, @var{Fs}, @var{window}, @var{overlap}, @var{range},
@var{plot_type}, @var{detrend})
+## Estimate cross power spectrum of data "x" and "y" by the Welch (1967)
+## periodogram/FFT method.
##
-## Estimate cross power spectrum of data "x" and "y" by the Welch (1967)
-## periodogram/FFT method. Compatible with Matlab R11 csd and earlier.
-## See "help pwelch" for description of arguments, hints and references
-## --- especially hint (7) for Matlab R11 defaults.
+## Compatible with Matlab R11 csd and earlier.
+##
+## See "help pwelch" for description of arguments, hints and references
+## --- especially hint (7) for Matlab R11 defaults.
+## @end deftypefn
function varargout = csd(varargin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/data2fun.m
new/signal-1.4.2/inst/data2fun.m
--- old/signal-1.4.1/inst/data2fun.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/data2fun.m 2022-04-23 13:21:25.000000000 +0200
@@ -1,4 +1,4 @@
-## Copyright (C) 2011 Juan Pablo Carbajal <[email protected]>
+## Copyright (C) 2020 Juan Pablo Carbajal
##
## 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
@@ -135,6 +135,10 @@
%!test
%! unwind_protect
+%! # Change to temporary folder in case tester cannot write current folder
+%! olddir = pwd();
+%! cd(tempdir());
+%!
%! [fhandle fname] = data2fun (t, y, "file", "testdata2fun");
%! yt = testdata2fun (t);
%! assert (y, yt);
@@ -142,21 +146,32 @@
%! unwind_protect_cleanup
%! unlink (fname);
%! unlink ([fname(1:end-2) ".mat"]);
+%! cd(olddir)
%! end_unwind_protect
%!test
%! unwind_protect
+%! # Change to temporary folder in case tester cannot write current folder
+%! olddir = pwd();
+%! cd(tempdir());
+%!
%! [fhandle fname] = data2fun (t, y, "file", "");
-%! yt = testdata2fun (t);
+%! # generate commmand to execute using random file name
+%! cmd = sprintf ("yt = %s(t);", nthargout (2, @fileparts, fname));
+%! eval (cmd);
%! assert (y, yt);
%! assert (y, fhandle (t));
%! unwind_protect_cleanup
%! unlink (fname);
%! unlink ([fname(1:end-2) ".mat"]);
+%! cd(olddir)
%! end_unwind_protect
%!test
%! unwind_protect
+%! # Change to temporary folder in case tester cannot write current folder
+%! olddir = pwd();
+%! cd(tempdir());
%! [fhandle fname] = data2fun (t, y, "file", "testdata2fun", "interp",
"linear");
%! yt = testdata2fun (t);
%! assert (y, yt);
@@ -164,6 +179,7 @@
%! unwind_protect_cleanup
%! unlink (fname);
%! unlink ([fname(1:end-2) ".mat"]);
+%! cd(olddir)
%! end_unwind_protect
## Test input validation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/impinvar.m
new/signal-1.4.2/inst/impinvar.m
--- old/signal-1.4.1/inst/impinvar.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/impinvar.m 2022-04-23 13:21:25.000000000 +0200
@@ -131,7 +131,7 @@
%! yz=filter(bz,az,[1 zeros(1,n-1)]);
%!
%! # find rms error
-%! err=sqrt(sum((yz*fs.-ys).^2)/length(ys));
+%! err=sqrt(sum((yz*fs-ys).^2)/length(ys));
%! endfunction
%!
%!assert(stozerr([1],[1 1],100),0,0.0001);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/invfreq.m
new/signal-1.4.2/inst/invfreq.m
--- old/signal-1.4.1/inst/invfreq.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/invfreq.m 2022-04-23 13:21:25.000000000 +0200
@@ -17,13 +17,15 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## usage: [B,A] = invfreq(H,F,nB,nA)
-## [B,A] = invfreq(H,F,nB,nA,W)
-## [B,A] = invfreq(H,F,nB,nA,W,[],[],plane)
-## [B,A] = invfreq(H,F,nB,nA,W,iter,tol,plane)
-##
+## -*- texinfo -*-
+## @deftypefn {Function File} {[B,A] =} invfreq(H,F,nB,nA)
+## @deftypefnx {} {[B,A] =} invfreq(H,F,nB,nA,W)
+## @deftypefnx {} {[B,A] =} invfreq(H,F,nB,nA,W,[],[],plane)
+## @deftypefnx {} {[B,A] =} invfreq(H,F,nB,nA,W,iter,tol,plane)
## Fit filter B(z)/A(z) or B(s)/A(s) to complex frequency response at
-## frequency points F. A and B are real polynomial coefficients of order
+## frequency points F.
+##
+## A and B are real polynomial coefficients of order
## nA and nB respectively. Optionally, the fit-errors can be weighted vs
## frequency according to the weights W. Also, the transform plane can be
## specified as either 's' for continuous time or 'z' for discrete time. 'z'
@@ -32,26 +34,38 @@
##
## H: desired complex frequency response
## It is assumed that A and B are real polynomials, hence H is one-sided.
+##
## F: vector of frequency samples in radians
+##
## nA: order of denominator polynomial A
+##
## nB: order of numerator polynomial B
+##
## plane='z': F on unit circle (discrete-time spectra, z-plane design)
+##
## plane='s': F on jw axis (continuous-time spectra, s-plane design)
+##
## H(k) = spectral samples of filter frequency response at points zk,
## where zk=exp(sqrt(-1)*F(k)) when plane='z' (F(k) in [0,.5])
## and zk=(sqrt(-1)*F(k)) when plane='s' (F(k) nonnegative)
+##
## Example:
+## @example
## [B,A] = butter(12,1/4);
## [H,w] = freqz(B,A,128);
## [Bh,Ah] = invfreq(H,F,4,4);
## Hh = freqz(Bh,Ah);
## disp(sprintf('||frequency response error|| = %f',norm(H-Hh)));
+## @end example
+##
+## References:
##
-## References: J. O. Smith, "Techniques for Digital Filter Design and System
+## J. O. Smith, "Techniques for Digital Filter Design and System
## Identification with Application to the Violin, Ph.D. Dissertation,
## Elec. Eng. Dept., Stanford University, June 1983, page 50; or,
##
## http://ccrma.stanford.edu/~jos/filters/FFT_Based_Equation_Error_Method.html
+## @end deftypefn
## FIXME: implement Steiglitz-McBride iterations
## FIXME: improve numerical stability for high order filters (matlab is a bit
better)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/invfreqs.m
new/signal-1.4.2/inst/invfreqs.m
--- old/signal-1.4.1/inst/invfreqs.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/invfreqs.m 2022-04-23 13:21:25.000000000 +0200
@@ -15,23 +15,32 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## Usage: [B,A] = invfreqs(H,F,nB,nA)
-## [B,A] = invfreqs(H,F,nB,nA,W)
-## [B,A] = invfreqs(H,F,nB,nA,W,iter,tol,'trace')
-##
+## -*- texinfo -*-
+## @deftypefn {Function File} {[B,A] =} invfreqs(H,F,nB,nA)
+## @deftypefnx {} {[B,A] =} invfreqs(H,F,nB,nA,W)
+## @deftypefnx {} {[B,A] =} invfreqs(H,F,nB,nA,W,iter,tol,'trace')
## Fit filter B(s)/A(s)to the complex frequency response H at frequency
-## points F. A and B are real polynomial coefficients of order nA and nB.
+## points F.
+##
+## A and B are real polynomial coefficients of order nA and nB.
+##
## Optionally, the fit-errors can be weighted vs frequency according to
## the weights W.
+##
## Note: all the guts are in invfreq.m
##
## H: desired complex frequency response
+##
## F: frequency (must be same length as H)
+##
## nA: order of the denominator polynomial A
+##
## nB: order of the numerator polynomial B
+##
## W: vector of weights (must be same length as F)
##
## Example:
+## @example
## B = [1/2 1];
## A = [1 1];
## w = linspace(0,4,128);
@@ -42,6 +51,8 @@
## legend('Original','Measured');
## err = norm(H-Hh);
## disp(sprintf('L2 norm of frequency response error = %f',err));
+## @end example
+## @end deftypefn
## FIXME: check invfreq.m for todo's
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/invfreqz.m
new/signal-1.4.2/inst/invfreqz.m
--- old/signal-1.4.1/inst/invfreqz.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/invfreqz.m 2022-04-23 13:21:25.000000000 +0200
@@ -15,28 +15,38 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## usage: [B,A] = invfreqz(H,F,nB,nA)
-## [B,A] = invfreqz(H,F,nB,nA,W)
-## [B,A] = invfreqz(H,F,nB,nA,W,iter,tol,'trace')
-##
+## -*- texinfo -*-
+## @deftypefn {Function File} {[B,A] =} invfreqz(H,F,nB,nA)
+## @deftypefnx {} {[B,A] =} invfreqz(H,F,nB,nA,W)
+## @deftypefnx {} {[B,A] =} invfreqz(H,F,nB,nA,W,iter,tol,'trace')
## Fit filter B(z)/A(z)to the complex frequency response H at frequency
-## points F. A and B are real polynomial coefficients of order nA and nB.
+## points F.
+##
+## A and B are real polynomial coefficients of order nA and nB.
## Optionally, the fit-errors can be weighted vs frequency according to
## the weights W.
+##
## Note: all the guts are in invfreq.m
##
## H: desired complex frequency response
+##
## F: normalized frequency (0 to pi) (must be same length as H)
+##
## nA: order of the denominator polynomial A
+##
## nB: order of the numerator polynomial B
+##
## W: vector of weights (must be same length as F)
##
## Example:
+## @example
## [B,A] = butter(4,1/4);
## [H,F] = freqz(B,A);
## [Bh,Ah] = invfreq(H,F,4,4);
## Hh = freqz(Bh,Ah);
## disp(sprintf('||frequency response error|| = %f',norm(H-Hh)));
+## @end example
+## @end deftypefn
## FIXME: check invfreq.m for todo's
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/invimpinvar.m
new/signal-1.4.2/inst/invimpinvar.m
--- old/signal-1.4.1/inst/invimpinvar.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/invimpinvar.m 2022-04-23 13:21:25.000000000 +0200
@@ -135,7 +135,7 @@
%! yz=filter(bz,az,[1 zeros(1,n-1)]);
%!
%! # find rms error
-%! err=sqrt(sum((yz*fs.-ys).^2)/length(ys));
+%! err=sqrt(sum((yz*fs-ys).^2)/length(ys));
%! endfunction
%!
%!assert(ztoserr([1],[1 -0.5],0.01),0,0.0001);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/ncauer.m
new/signal-1.4.2/inst/ncauer.m
--- old/signal-1.4.1/inst/ncauer.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/ncauer.m 2022-04-23 13:21:25.000000000 +0200
@@ -14,22 +14,35 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## usage: [Zz, Zp, Zg] = ncauer(Rp, Rs, n)
-##
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{z}, @var{p}, @var{g}] =} cauer(@var{Rp},
@var{Rs}, @var{n})
## Analog prototype for Cauer filter.
-## [z, p, g]=ncauer(Rp, Rs, ws)
-## Rp = Passband ripple
-## Rs = Stopband ripple
-## Ws = Desired order
+##
+## @table @asis
+## @item Rp
+## Passband ripple
+## @item Rs
+## Stopband ripple
+## @item n
+## Desired order
+## @item z
+## complex vector of zeros for the model.
+## @item p
+## complex vector of poles for the model.
+## @item g
+## gain value.
+## @end table
##
## References:
##
## - Serra, Celso Penteado, Teoria e Projeto de Filtros, Campinas: CARTGRAF,
## 1983.
+##
## - Lamar, Marcus Vinicius, Notas de aula da disciplina TE 456 - Circuitos
## Analogicos II, UFPR, 2001/2002.
+## @end deftypefn
-function [zer, pol, T0]=ncauer(Rp, Rs, n)
+function [zer, pol, T0] = ncauer (Rp, Rs, n)
## Cutoff frequency = 1:
wp=1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/pburg.m
new/signal-1.4.2/inst/pburg.m
--- old/signal-1.4.1/inst/pburg.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/pburg.m 2022-04-23 13:21:25.000000000 +0200
@@ -14,82 +14,111 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## usage:
-## [psd,f_out] = pburg(x,poles,freq,Fs,range,method,plot_type,criterion)
-##
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{psd},@var{f_out}] =} pburg(@var{x},
@var{poles}, @var{freq}, @var{Fs}, @var{range}, @var{method}, @var{plot_type},
@var{criterion})
## Calculate Burg maximum-entropy power spectral density.
+##
## The functions "arburg" and "ar_psd" do all the work.
## See "help arburg" and "help ar_psd" for further details.
##
## ARGUMENTS:
+##
## All but the first two arguments are optional and may be empty.
-## x %% [vector] sampled data
##
-## poles %% [integer scalar] required number of poles of the AR model
+## @table @asis
+## @item x
+## [vector] sampled data
+## @item poles
+## [integer scalar] required number of poles of the AR model
+## @item freq
+## [real vector] frequencies at which power spectral density is calculated.
+##
+## [integer scalar] number of uniformly distributed frequency
+## values at which spectral density is calculated.
+## [default=256]
+## @item Fs
+## [real scalar] sampling frequency (Hertz) [default=1]
+## @end table
##
-## freq %% [real vector] frequencies at which power spectral density
-## %% is calculated
-## %% [integer scalar] number of uniformly distributed frequency
-## %% values at which spectral density is calculated.
-## %% [default=256]
+## CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
##
-## Fs %% [real scalar] sampling frequency (Hertz) [default=1]
+## Control-string arguments can be in any order after the other arguments.
##
##
-## CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
-## Control-string arguments can be in any order after the other arguments.
+## @table @asis
+## @item range
+## 'half', 'onesided' : frequency range of the spectrum is
+## from zero up to but not including sample_f/2. Power
+## from negative frequencies is added to the positive
+## side of the spectrum.
+##
+## 'whole', 'twosided' : frequency range of the spectrum is
+## -sample_f/2 to sample_f/2, with negative frequencies
+## stored in "wrap around" order after the positive
+## frequencies; e.g. frequencies for a 10-point 'twosided'
+## spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
+##
+## 'shift', 'centerdc' : same as 'whole' but with the first half
+## of the spectrum swapped with second half to put the
+## zero-frequency value in the middle. (See "help
+## fftshift". If "freq" is vector, 'shift' is ignored.
+## If model coefficients "ar_coeffs" are real, the default
+## range is 'half', otherwise default range is 'whole'.
+##
+## @item method
+## 'fft': use FFT to calculate power spectral density.
+##
+## 'poly': calculate spectral density as a polynomial of 1/z
+## N.B. this argument is ignored if the "freq" argument is a
+## vector. The default is 'poly' unless the "freq"
+## argument is an integer power of 2.
+##
+## @item plot_type
+## 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
+## specifies the type of plot. The default is 'plot', which
+## means linear-linear axes. 'squared' is the same as 'plot'.
+## 'dB' plots "10*log10(psd)". This argument is ignored and a
+## spectrum is not plotted if the caller requires a returned
+## value.
+##
+## @item criterion
+## [optional string arg] model-selection criterion. Limits
+## the number of poles so that spurious poles are not
+## added when the whitened data has no more information
+## in it (see Kay & Marple, 1981). Recognized values are
+##
+## 'AKICc' -- approximate corrected Kullback information
+## criterion (recommended),
+##
+## 'KIC' -- Kullback information criterion
##
+## 'AICc' -- corrected Akaike information criterion
##
-## range %% 'half', 'onesided' : frequency range of the spectrum is
-## %% from zero up to but not including sample_f/2. Power
-## %% from negative frequencies is added to the positive
-## %% side of the spectrum.
-## %% 'whole', 'twosided' : frequency range of the spectrum is
-## %% -sample_f/2 to sample_f/2, with negative frequencies
-## %% stored in "wrap around" order after the positive
-## %% frequencies; e.g. frequencies for a 10-point 'twosided'
-## %% spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
-## %% 'shift', 'centerdc' : same as 'whole' but with the first half
-## %% of the spectrum swapped with second half to put the
-## %% zero-frequency value in the middle. (See "help
-## %% fftshift". If "freq" is vector, 'shift' is ignored.
-## %% If model coefficients "ar_coeffs" are real, the default
-## %% range is 'half', otherwise default range is 'whole'.
-##
-## method %% 'fft': use FFT to calculate power spectral density.
-## %% 'poly': calculate spectral density as a polynomial of 1/z
-## %% N.B. this argument is ignored if the "freq" argument is a
-## %% vector. The default is 'poly' unless the "freq"
-## %% argument is an integer power of 2.
-##
-## plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
-## %% specifies the type of plot. The default is 'plot', which
-## %% means linear-linear axes. 'squared' is the same as 'plot'.
-## %% 'dB' plots "10*log10(psd)". This argument is ignored and a
-## %% spectrum is not plotted if the caller requires a returned
-## %% value.
-##
-## criterion %% [optional string arg] model-selection criterion. Limits
-## %% the number of poles so that spurious poles are not
-## %% added when the whitened data has no more information
-## %% in it (see Kay & Marple, 1981). Recognized values are
-## %% 'AKICc' -- approximate corrected Kullback information
-## %% criterion (recommended),
-## %% 'KIC' -- Kullback information criterion
-## %% 'AICc' -- corrected Akaike information criterion
-## %% 'AIC' -- Akaike information criterion
-## %% 'FPE' -- final prediction error" criterion
-## %% The default is to NOT use a model-selection criterion
+## 'AIC' -- Akaike information criterion
+##
+## 'FPE' -- final prediction error" criterion
+##
+## The default is to NOT use a model-selection criterion
+## @end table
##
## RETURNED VALUES:
+##
## If return values are not required by the caller, the spectrum
## is plotted and nothing is returned.
-## psd %% [real vector] power-spectral density estimate
-## f_out %% [real vector] frequency values
+##
+## @table @asis
+## @item psd
+## [real vector] power-spectral density estimate
+## @item f_out
+## [real vector] frequency values
+## @end table
##
## HINTS
+##
## This function is a wrapper for arburg and ar_psd.
+##
## See "help arburg", "help ar_psd".
+## @end deftypefn
function [psd,f_out]=pburg(x,poles,varargin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/pwelch.m
new/signal-1.4.2/inst/pwelch.m
--- old/signal-1.4.1/inst/pwelch.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/pwelch.m 2022-04-23 13:21:25.000000000 +0200
@@ -14,159 +14,202 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## USAGE:
-## [spectra,freq] = pwelch(x,window,overlap,Nfft,Fs,
-## range,plot_type,detrend,sloppy)
-## Estimate power spectral density of data "x" by the Welch (1967)
-## periodogram/FFT method. All arguments except "x" are optional.
-## The data is divided into segments. If "window" is a vector, each
-## segment has the same length as "window" and is multiplied by "window"
-## before (optional) zero-padding and calculation of its periodogram. If
-## "window" is a scalar, each segment has a length of "window" and a
-## Hamming window is used.
-## The spectral density is the mean of the periodograms, scaled so that
-## area under the spectrum is the same as the mean square of the
-## data. This equivalence is supposed to be exact, but in practice there
-## is a mismatch of up to 0.5% when comparing area under a periodogram
-## with the mean square of the data.
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{spectra},@var{freq}] =} pwelch(@var{x},
@var{window}, @var{overlap}, @var{Nfft}, @var{Fs}, @var{range},
@var{plot_type}, @var{detrend}, @var{sloppy})
+## Estimate power spectral density of data "x" by the Welch (1967)
periodogram/FFT method.
+##
+## All arguments except "x" are optional.
+##
+## The data is divided into segments. If "window" is a vector, each
+## segment has the same length as "window" and is multiplied by "window"
+## before (optional) zero-padding and calculation of its periodogram. If
+## "window" is a scalar, each segment has a length of "window" and a
+## Hamming window is used.
+##
+## The spectral density is the mean of the periodograms, scaled so that
+## area under the spectrum is the same as the mean square of the
+## data. This equivalence is supposed to be exact, but in practice there
+## is a mismatch of up to 0.5% when comparing area under a periodogram
+## with the mean square of the data.
##
-## [spectra,freq] = pwelch(x,y,window,overlap,Nfft,Fs,
+## [spectra,freq] = pwelch(x,y,window,overlap,Nfft,Fs,
## range,plot_type,detrend,sloppy,results)
-## Two-channel spectrum analyser. Estimate power spectral density, cross-
-## spectral density, transfer function and/or coherence functions of time-
-## series input data "x" and output data "y" by the Welch (1967)
-## periodogram/FFT method.
-## pwelch treats the second argument as "y" if there is a control-string
-## argument "cross", "trans", "coher" or "ypower"; "power" does not force
-## the 2nd argument to be treated as "y". All other arguments are
-## optional. All spectra are returned in matrix "spectra".
-##
-## [spectra,Pxx_ci,freq] = pwelch(x,window,overlap,Nfft,Fs,conf,
-## range,plot_type,detrend,sloppy)
-## [spectra,Pxx_ci,freq] = pwelch(x,y,window,overlap,Nfft,Fs,conf,
-## range,plot_type,detrend,sloppy,results)
-## Estimates confidence intervals for the spectral density.
-## See Hint (7) below for compatibility options. Confidence level "conf"
-## is the 6th or 7th numeric argument. If "results" control-string
-## arguments are used, one of them must be "power" when the "conf"
-## argument is present; pwelch can estimate confidence intervals only for
-## the power spectrum of the "x" data. It does not know how to estimate
-## confidence intervals of the cross-power spectrum, transfer function or
-## coherence; if you can suggest a good method, please send a bug report.
+##
+## Two-channel spectrum analyser. Estimate power spectral density, cross-
+## spectral density, transfer function and/or coherence functions of time-
+## series input data "x" and output data "y" by the Welch (1967)
+## periodogram/FFT method.
+##
+## pwelch treats the second argument as "y" if there is a control-string
+## argument "cross", "trans", "coher" or "ypower"; "power" does not force
+## the 2nd argument to be treated as "y". All other arguments are
+## optional. All spectra are returned in matrix "spectra".
+##
+## [spectra,Pxx_ci,freq] = pwelch(x,window,overlap,Nfft,Fs,conf,
+## range,plot_type,detrend,sloppy)
+##
+## [spectra,Pxx_ci,freq] = pwelch(x,y,window,overlap,Nfft,Fs,conf,
+## range,plot_type,detrend,sloppy,results)
+##
+## Estimates confidence intervals for the spectral density.
+##
+## See Hint (7) below for compatibility options.
+##
+## Confidence level "conf" is the 6th or 7th numeric argument. If "results"
control-string
+## arguments are used, one of them must be "power" when the "conf"
+## argument is present; pwelch can estimate confidence intervals only for
+## the power spectrum of the "x" data. It does not know how to estimate
+## confidence intervals of the cross-power spectrum, transfer function or
+## coherence; if you can suggest a good method, please send a bug report.
##
## ARGUMENTS
+##
## All but the first argument are optional and may be empty, except that
## the "results" argument may require the second argument to be "y".
-##
-## x %% [non-empty vector] system-input time-series data
-## y %% [non-empty vector] system-output time-series data
-##
-## window %% [real vector] of window-function values between 0 and 1; the
-## %% data segment has the same length as the window.
-## %% Default window shape is Hamming.
-## %% [integer scalar] length of each data segment. The default
-## %% value is window=sqrt(length(x)) rounded up to the
-## %% nearest integer power of 2; see 'sloppy' argument.
-##
-## overlap %% [real scalar] segment overlap expressed as a multiple of
-## %% window or segment length. 0 <= overlap < 1,
-## %% The default is overlap=0.5 .
-##
-## Nfft %% [integer scalar] Length of FFT. The default is the length
-## %% of the "window" vector or has the same value as the
-## %% scalar "window" argument. If Nfft is larger than the
-## %% segment length, "seg_len", the data segment is padded
-## %% with "Nfft-seg_len" zeros. The default is no padding.
-## %% Nfft values smaller than the length of the data
-## %% segment (or window) are ignored silently.
-##
-## Fs %% [real scalar] sampling frequency (Hertz); default=1.0
-##
-## conf %% [real scalar] confidence level between 0 and 1. Confidence
-## %% intervals of the spectral density are estimated from
-## %% scatter in the periodograms and are returned as Pxx_ci.
-## %% Pxx_ci(:,1) is the lower bound of the confidence
-## %% interval and Pxx_ci(:,2) is the upper bound. If there
-## %% are three return values, or conf is an empty matrix,
-## %% confidence intervals are calculated for conf=0.95 .
-## %% If conf is zero or is not given, confidence intervals
-## %% are not calculated. Confidence intervals can be
-## %% obtained only for the power spectral density of x;
-## %% nothing else.
+## @table @asis
+## @item x
+## [non-empty vector] system-input time-series data
+## @item y
+## [non-empty vector] system-output time-series data
+## @item window
+## [real vector] of window-function values between 0 and 1; the
+## data segment has the same length as the window.
+## Default window shape is Hamming.
+##
+## [integer scalar] length of each data segment. The default
+## value is window=sqrt(length(x)) rounded up to the
+## nearest integer power of 2; see 'sloppy' argument.
+##
+## @item overlap
+## [real scalar] segment overlap expressed as a multiple of
+## window or segment length. 0 <= overlap < 1,
+## The default is overlap=0.5 .
+##
+## @item Nfft
+## [integer scalar] Length of FFT. The default is the length
+## of the "window" vector or has the same value as the
+## scalar "window" argument. If Nfft is larger than the
+## segment length, "seg_len", the data segment is padded
+## with "Nfft-seg_len" zeros. The default is no padding.
+## Nfft values smaller than the length of the data
+## segment (or window) are ignored silently.
+##
+## @item Fs
+## [real scalar] sampling frequency (Hertz); default=1.0
+##
+## @item conf
+## [real scalar] confidence level between 0 and 1. Confidence
+## intervals of the spectral density are estimated from
+## scatter in the periodograms and are returned as Pxx_ci.
+## Pxx_ci(:,1) is the lower bound of the confidence
+## interval and Pxx_ci(:,2) is the upper bound. If there
+## are three return values, or conf is an empty matrix,
+## confidence intervals are calculated for conf=0.95 .
+## If conf is zero or is not given, confidence intervals
+## are not calculated. Confidence intervals can be
+## obtained only for the power spectral density of x;
+## nothing else.
+## @end table
##
## CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
## Control-string arguments must be after the other arguments but can be in
## any order.
##
-## range %% 'half', 'onesided' : frequency range of the spectrum is
-## %% zero up to but not including Fs/2. Power from
-## %% negative frequencies is added to the positive side of
-## %% the spectrum, but not at zero or Nyquist (Fs/2)
-## %% frequencies. This keeps power equal in time and
-## %% spectral domains. See reference [2].
-## %% 'whole', 'twosided' : frequency range of the spectrum is
-## %% -Fs/2 to Fs/2, with negative frequencies
-## %% stored in "wrap around" order after the positive
-## %% frequencies; e.g. frequencies for a 10-point 'twosided'
-## %% spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
-## %% 'shift', 'centerdc' : same as 'whole' but with the first half
-## %% of the spectrum swapped with second half to put the
-## %% zero-frequency value in the middle. (See "help
-## %% fftshift".
-## %% If data (x and y) are real, the default range is 'half',
-## %% otherwise default range is 'whole'.
-##
-## plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
-## %% specifies the type of plot. The default is 'plot', which
-## %% means linear-linear axes. 'squared' is the same as 'plot'.
-## %% 'dB' plots "10*log10(psd)". This argument is ignored and a
-## %% spectrum is not plotted if the caller requires a returned
-## %% value.
-##
-## detrend %% 'no-strip', 'none' -- do NOT remove mean value from the data
-## %% 'short', 'mean' -- remove the mean value of each segment from
-## %% each segment of the data.
-## %% 'linear', -- remove linear trend from each segment of
-## %% the data.
-## %% 'long-mean' -- remove the mean value from the data before
-## %% splitting it into segments. This is the default.
-##
-## sloppy %% 'sloppy': FFT length is rounded up to the nearest integer
-## %% power of 2 by zero padding. FFT length is adjusted
-## %% after addition of padding by explicit Nfft argument.
-## %% The default is to use exactly the FFT and window/
-
-## %% segment lengths specified in argument list.
+## @table @asis
+## @item range
+## 'half', 'onesided' : frequency range of the spectrum is
+## zero up to but not including Fs/2. Power from
+## negative frequencies is added to the positive side of
+## the spectrum, but not at zero or Nyquist (Fs/2)
+## frequencies. This keeps power equal in time and
+## spectral domains. See reference [2].
+##
+## 'whole', 'twosided' : frequency range of the spectrum is
+## -Fs/2 to Fs/2, with negative frequencies
+## stored in "wrap around" order after the positive
+## frequencies; e.g. frequencies for a 10-point 'twosided'
+## spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
+##
+## 'shift', 'centerdc' : same as 'whole' but with the first half
+## of the spectrum swapped with second half to put the
+## zero-frequency value in the middle. (See "help
+## fftshift".
+##
+## If data (x and y) are real, the default range is 'half',
+## otherwise default range is 'whole'.
+##
+## @item plot_type
+## 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
+## specifies the type of plot. The default is 'plot', which
+## means linear-linear axes. 'squared' is the same as 'plot'.
+## 'dB' plots "10*log10(psd)". This argument is ignored and a
+## spectrum is not plotted if the caller requires a returned
+## value.
+##
+## @item detrend
+## 'no-strip', 'none' -- do NOT remove mean value from the data
+##
+## 'short', 'mean' -- remove the mean value of each segment from
+## each segment of the data.
+##
+## 'linear', -- remove linear trend from each segment of
+## the data.
+##
+## 'long-mean' -- remove the mean value from the data before
+## splitting it into segments. This is the default.
+##
+## @item sloppy
+## 'sloppy': FFT length is rounded up to the nearest integer
+## power of 2 by zero padding. FFT length is adjusted
+## after addition of padding by explicit Nfft argument.
+## The default is to use exactly the FFT and window/
+## segment lengths specified in argument list.
+##
+## @item results
+## specifies what results to return (in the order specified
+## and as many as desired).
+##
+## 'power' calculate power spectral density of "x"
+##
+## 'cross' calculate cross spectral density of "x" and "y"
+##
+## 'trans' calculate transfer function of a system with
+## input "x" and output "y"
##
-## results %% specifies what results to return (in the order specified
-## %% and as many as desired).
-## %% 'power' calculate power spectral density of "x"
-## %% 'cross' calculate cross spectral density of "x" and "y"
-## %% 'trans' calculate transfer function of a system with
-## %% input "x" and output "y"
-## %% 'coher' calculate coherence function of "x" and "y"
-## %% 'ypower' calculate power spectral density of "y"
-## %% The default is 'power', with argument "y" omitted.
+## 'coher' calculate coherence function of "x" and "y"
+##
+## 'ypower' calculate power spectral density of "y"
+##
+## The default is 'power', with argument "y" omitted.
+## @end table
##
## RETURNED VALUES:
+##
## If return values are not required by the caller, the results are
## plotted and nothing is returned.
##
-## spectra %% [real-or-complex matrix] columns of the matrix contain results
-## %% in the same order as specified by "results" arguments.
-## %% Each column contains one of the result vectors.
-##
-## Pxx_ci %% [real matrix] estimate of confidence interval for power
-## %% spectral density of x. First column is the lower
-## %% bound. Second column is the upper bound.
-##
-## freq %% [real column vector] frequency values
+## @table @asis
+## @item spectra
+## [real-or-complex matrix] columns of the matrix contain results
+## in the same order as specified by "results" arguments.
+## Each column contains one of the result vectors.
+##
+## @item Pxx_ci
+## [real matrix] estimate of confidence interval for power
+## spectral density of x. First column is the lower
+## bound. Second column is the upper bound.
+##
+## @item freq
+## [real column vector] frequency values
+## @end table
##
## HINTS
-## 1) EMPTY ARGS:
+## @enumerate
+## @item EMPTY ARGS:
## if you don't want to use an optional argument you can leave it empty
## by writing its value as [].
-## 2) FOR BEGINNERS:
+##
+## @item FOR BEGINNERS:
## The profusion of arguments may make pwelch difficult to use, and an
## unskilled user can easily produce a meaningless result or can easily
## mis-interpret the result. With real data "x" and sampling frequency
@@ -175,7 +218,8 @@
## control the length of the spectrum vector. For real data and integer
## scalar M, "pwelch(x,2*M,[],[],Fs)" gives an M+1 point spectrum.
## Run "demo pwelch" (octave only).
-## 3) WINDOWING FUNCTIONS:
+##
+## @item WINDOWING FUNCTIONS:
## Without a window function, sharp spectral peaks can have strong
## sidelobes because the FFT of a data in a segment is in effect convolved
## with a rectangular window. A window function which tapers off
@@ -188,51 +232,63 @@
## 20dB/decade. You can inspect the FFT of a Hann window by plotting
## "abs(fft(postpad(hanning(256),4096,0)))".
## The default window is Hamming.
-## 4) ZERO PADDING:
+##
+## @item ZERO PADDING:
## Zero-padding reduces the frequency step in the
## spectrum, and produces an artificially smoothed spectrum. For example,
## "Nfft=2*length(window)" gives twice as many frequency values, but
## adjacent PSD (power spectral density) values are not independent;
## adjacent PSD values are independent if "Nfft=length(window)", which is
## the default value of Nfft.
-## 5) REMOVING MEAN FROM SIGNAL:
+##
+## @item REMOVING MEAN FROM SIGNAL:
## If the mean is not removed from the signal there is a large spectral
## peak at zero frequency and the sidelobes of this peak are likely to
## swamp the rest of the spectrum. For this reason, the default behavior
## is to remove the mean. However, the matlab pwelch does not do this.
-## 6) WARNING ON CONFIDENCE INTERVALS
+##
+## @item WARNING ON CONFIDENCE INTERVALS
## Confidence intervals are obtained by measuring the sample variance of
## the periodograms and assuming that the periodograms have a Gaussian
## probability distribution. This assumption is not accurate. If, for
## example, the data (x) is Gaussian, the periodogram has a Rayleigh
## distribution. However, the confidence intervals may still be useful.
##
-## 7) COMPATIBILITY WITH Matlab R11, R12, etc
+## @item COMPATIBILITY WITH Matlab R11, R12, etc
## When used without the second data (y) argument, arguments are compatible
## with the pwelch of Matlab R12, R13, R14, 2006a and 2006b except that
+##
## 1) overlap is expressed as a multiple of window length ---
## effect of overlap scales with window length
+##
## 2) default values of length(window), Nfft and Fs are more sensible, and
+##
## 3) Goertzel algorithm is not available so Nfft cannot be an array of
## frequencies as in Matlab 2006b.
+##
## Pwelch has four persistent Matlab-compatibility levels. Calling pwelch
## with an empty first argument sets the order of arguments and defaults
## specified above in the USAGE and ARGUMENTS section of this documentation.
+## @example
## prev_compat=pwelch([]);
## [Pxx,f]=pwelch(x,window,overlap,Nfft,Fs,conf,...);
+## @end example
## Calling pwelch with a single string argument (as described below) gives
## compatibility with Matlab R11 or R12, or the R14 spectrum.welch
## defaults. The returned value is the PREVIOUS compatibility string.
##
## Matlab R11: For compatibility with the Matlab R11 pwelch:
+## @example
## prev_compat=pwelch('R11-');
## [Pxx,f]=pwelch(x,Nfft,Fs,window,overlap,conf,range,units);
## %% units of overlap are "number of samples"
## %% defaults: Nfft=min(length(x),256), Fs=2*pi, length(window)=Nfft,
## %% window=Hanning, do not detrend,
## %% N.B. "Sloppy" is not available.
+## @end example
##
## Matlab R12: For compatibility with Matlab R12 to 2006a pwelch:
+## @example
## prev_compat=pwelch('R12+');
## [Pxx,f]=pwelch(x,window,overlap,nfft,Fs,...);
## %% units of overlap are "number of samples"
@@ -241,9 +297,11 @@
## %% NextPow2 is the next power of 2 greater than or equal to the
## %% window length. "Sloppy", "conf" are not available. Default
## %% window length gives very poor amplitude resolution.
+## @end example
##
## To adopt defaults of the Matlab R14 "spectrum.welch" spectrum object
## associated "psd" method.
+## @example
## prev_compat=pwelch('psd');
## [Pxx,f] = pwelch(x,window,overlap,Nfft,Fs,conf,...);
## %% overlap is expressed as a percentage of window length,
@@ -252,9 +310,11 @@
## %% NextPow2 is the next power of 2 greater than or equal to the
## %% window length. "Sloppy" is not available.
## %% Default window length gives coarse frequency resolution.
-##
+## @end example
+## @end enumerate
##
## REFERENCES
+##
## [1] Peter D. Welch (June 1967):
## "The use of fast Fourier transform for the estimation of power spectra:
## a method based on time averaging over short, modified periodograms."
@@ -264,6 +324,7 @@
## Brian P. Flannery",
## "Numerical recipes in C, The art of scientific computing", 2nd edition,
## Cambridge University Press, 2002 --- Section 13.7.
+## @end deftypefn
function varargout = pwelch(x,varargin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/pyulear.m
new/signal-1.4.2/inst/pyulear.m
--- old/signal-1.4.1/inst/pyulear.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/pyulear.m 2022-04-23 13:21:25.000000000 +0200
@@ -14,71 +14,98 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## usage:
-## [psd,f_out] = pyulear(x,poles,freq,Fs,range,method,plot_type)
-##
+## -*- texinfo -*-
+## @deftypefn {Function File} {[psd,f_out] =}
pyulear(x,poles,freq,Fs,range,method,plot_type)
## Calculates a Yule-Walker autoregressive (all-pole) model of the data "x"
-## and computes the power spectrum of the model. This is a wrapper for
-## functions "aryule" and "ar_psd" which perform the argument checking.
-## See "help aryule" and "help ar_psd" for further details.
+## and computes the power spectrum of the model.
##
-## ARGUMENTS:
-## All but the first two arguments are optional and may be empty.
-## x %% [vector] sampled data
+## This is a wrapper for functions "aryule" and "ar_psd" which perform the
+## argument checking.
##
-## poles %% [integer scalar] required number of poles of the AR model
-##
-## freq %% [real vector] frequencies at which power spectral density
-## %% is calculated
-## %% [integer scalar] number of uniformly distributed frequency
-## %% values at which spectral density is calculated.
-## %% [default=256]
+## See "help aryule" and "help ar_psd" for further details.
##
-## Fs %% [real scalar] sampling frequency (Hertz) [default=1]
+## ARGUMENTS:
##
+## All but the first two arguments are optional and may be empty.
+## @table @asis
+## @item x
+## [vector] sampled data
+##
+## @item poles
+## [integer scalar] required number of poles of the AR model
+##
+## @item freq
+## [real vector] frequencies at which power spectral density
+## is calculated
+##
+## [integer scalar] number of uniformly distributed frequency
+## values at which spectral density is calculated.
+## [default=256]
+##
+## @item Fs
+## [real scalar] sampling frequency (Hertz) [default=1]
+## @end table
##
## CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
-## Control-string arguments can be in any order after the other arguments.
##
+## Control-string arguments can be in any order after the other arguments.
##
-## range %% 'half', 'onesided' : frequency range of the spectrum is
-## %% from zero up to but not including sample_f/2. Power
-## %% from negative frequencies is added to the positive
-## %% side of the spectrum.
-## %% 'whole', 'twosided' : frequency range of the spectrum is
-## %% -sample_f/2 to sample_f/2, with negative frequencies
-## %% stored in "wrap around" order after the positive
-## %% frequencies; e.g. frequencies for a 10-point 'twosided'
-## %% spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
-## %% 'shift', 'centerdc' : same as 'whole' but with the first half
-## %% of the spectrum swapped with second half to put the
-## %% zero-frequency value in the middle. (See "help
-## %% fftshift". If "freq" is vector, 'shift' is ignored.
-## %% If model coefficients "ar_coeffs" are real, the default
-## %% range is 'half', otherwise default range is 'whole'.
-##
-## method %% 'fft': use FFT to calculate power spectrum.
-## %% 'poly': calculate power spectrum as a polynomial of 1/z
-## %% N.B. this argument is ignored if the "freq" argument is a
-## %% vector. The default is 'poly' unless the "freq"
-## %% argument is an integer power of 2.
-##
-## plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
-## %% specifies the type of plot. The default is 'plot', which
-## %% means linear-linear axes. 'squared' is the same as 'plot'.
-## %% 'dB' plots "10*log10(psd)". This argument is ignored and a
-## %% spectrum is not plotted if the caller requires a returned
-## %% value.
+## @table @asis
+## @item range
+## 'half', 'onesided' : frequency range of the spectrum is
+## from zero up to but not including sample_f/2. Power
+## from negative frequencies is added to the positive
+## side of the spectrum.
+##
+## 'whole', 'twosided' : frequency range of the spectrum is
+## -sample_f/2 to sample_f/2, with negative frequencies
+## stored in "wrap around" order after the positive
+## frequencies; e.g. frequencies for a 10-point 'twosided'
+## spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
+##
+## 'shift', 'centerdc' : same as 'whole' but with the first half
+## of the spectrum swapped with second half to put the
+## zero-frequency value in the middle. (See "help
+## fftshift". If "freq" is vector, 'shift' is ignored.
+##
+## If model coefficients "ar_coeffs" are real, the default
+## range is 'half', otherwise default range is 'whole'.
+##
+## @item method
+## 'fft': use FFT to calculate power spectrum.
+##
+## 'poly': calculate power spectrum as a polynomial of 1/z
+## N.B. this argument is ignored if the "freq" argument is a
+## vector. The default is 'poly' unless the "freq"
+## argument is an integer power of 2.
+##
+## @item plot_type
+## 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
+## specifies the type of plot. The default is 'plot', which
+## means linear-linear axes. 'squared' is the same as 'plot'.
+## 'dB' plots "10*log10(psd)". This argument is ignored and a
+## spectrum is not plotted if the caller requires a returned
+## value.
+## @end table
##
## RETURNED VALUES:
+##
## If return values are not required by the caller, the spectrum
## is plotted and nothing is returned.
-## psd %% [real vector] power-spectrum estimate
-## f_out %% [real vector] frequency values
+##
+## @table @asis
+## @item psd
+## [real vector] power-spectrum estimate
+## @item f_out
+## [real vector] frequency values
+## @end table
##
## HINTS
+##
## This function is a wrapper for aryule and ar_psd.
+##
## See "help aryule", "help ar_psd".
+## @end deftypefn
function [psd,f_out]=pyulear(x,poles,varargin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/sos2ss.m
new/signal-1.4.2/inst/sos2ss.m
--- old/signal-1.4.1/inst/sos2ss.m 1970-01-01 01:00:00.000000000 +0100
+++ new/signal-1.4.2/inst/sos2ss.m 2022-04-23 13:21:25.000000000 +0200
@@ -0,0 +1,40 @@
+## Copyright (C) 2018 John W. Eaton
+##
+## 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; see the file COPYING. If not, see
+## <https://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{a}, @var{b}, @var{c}, @var{d}] =} sos2ss
(@var{sos})
+## Convert series second-order sections to state-space.
+##
+## @seealso{sos2ss, ss2tf}
+## @end deftypefn
+
+function [a, b, c, d] = sos2ss (sos, g = 1)
+
+ if (nargin < 1 || nargin > 2)
+ print_usage ();
+ endif
+
+ [num, den] = sos2tf (sos, g);
+
+ [a, b, c, d] = tf2ss (num, den);
+
+endfunction
+
+%!test
+%! sos = [1, 1, 0, 1, 0.5, 0];
+%! g = 1;
+%! [a, b, c, d] = sos2ss (sos, g);
+%! assert ({a, b, c, d}, {-0.5, 0.5, 1, 1});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/ss2zp.m
new/signal-1.4.2/inst/ss2zp.m
--- old/signal-1.4.1/inst/ss2zp.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/ss2zp.m 2022-04-23 13:21:25.000000000 +0200
@@ -16,7 +16,7 @@
## <https://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{p}, @var{z}, @var{k}] =} ss2zp (@var{a},
@var{b}, @var{c}, @var{d})
+## @deftypefn {Function File} {[@var{z}, @var{p}, @var{k}] =} ss2zp (@var{a},
@var{b}, @var{c}, @var{d})
## Converts a state space representation to a set of poles and zeros;
## @var{k} is a gain associated with the zeros.
##
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/inst/tfe.m new/signal-1.4.2/inst/tfe.m
--- old/signal-1.4.1/inst/tfe.m 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/inst/tfe.m 2022-04-23 13:21:25.000000000 +0200
@@ -14,14 +14,17 @@
## along with this program; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
-## Usage:
-## [Pxx,freq] = tfe(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
+## -*- texinfo -*-
+## @deftypefn {Function File} {[Pxx,freq] =}
tfe(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
+## Estimate transfer function of system with input "x" and output "y".
##
-## Estimate transfer function of system with input "x" and output "y".
-## Use the Welch (1967) periodogram/FFT method.
-## Compatible with Matlab R11 tfe and earlier.
-## See "help pwelch" for description of arguments, hints and references
-## --- especially hint (7) for Matlab R11 defaults.
+## Use the Welch (1967) periodogram/FFT method.
+##
+## Compatible with Matlab R11 tfe and earlier.
+##
+## See "help pwelch" for description of arguments, hints and references
+## --- especially hint (7) for Matlab R11 defaults.
+## @end deftypefn
function varargout = tfe(varargin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/src/Makefile
new/signal-1.4.2/src/Makefile
--- old/signal-1.4.1/src/Makefile 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/src/Makefile 2022-04-23 13:21:25.000000000 +0200
@@ -19,7 +19,7 @@
MKOCTFILE ?= mkoctfile
SED ?= sed
-PKG_CXXFLAGS := -Wall -Wno-deprecated-declarations $(PKG_CXXFLAGS_APPEND)
+PKG_CXXFLAGS := -Wall $(PKG_CXXFLAGS_APPEND)
OCT_FILES = \
__fwht__.oct \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/src/cl2bp.cc
new/signal-1.4.2/src/cl2bp.cc
--- old/signal-1.4.1/src/cl2bp.cc 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/src/cl2bp.cc 2022-04-23 13:21:25.000000000 +0200
@@ -89,30 +89,10 @@
}
const int m = args(0).int_value(true);
- if (error_state) {
- err_wrong_type_arg ("cl2bp", args(0));
- return retval;
- }
const double w1 = args(1).double_value();
- if (error_state) {
- err_wrong_type_arg ("cl2bp", args(1));
- return retval;
- }
const double w2 = args(2).double_value();
- if (error_state) {
- err_wrong_type_arg ("cl2bp", args(2));
- return retval;
- }
const ColumnVector up_vector(args(3).vector_value());
- if (error_state) {
- err_wrong_type_arg ("cl2bp", args(3));
- return retval;
- }
const ColumnVector lo_vector(args(4).vector_value());
- if (error_state) {
- err_wrong_type_arg ("cl2bp", args(4));
- return retval;
- }
if (up_vector.numel() != 3 || lo_vector.numel() != 3) {
error("cl2bp: The up and lo vectors must contain 3 values");
return retval;
@@ -126,10 +106,6 @@
}
const int L = args(5).int_value(true);
- if (error_state) {
- err_wrong_type_arg ("cl2bp", args(5));
- return retval;
- }
if (L > 1000000) {
error("cl2bp: The \"gridsize\" parameter cannot exceed 1000000");
return retval;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/src/sosfilt.cc
new/signal-1.4.2/src/sosfilt.cc
--- old/signal-1.4.1/src/sosfilt.cc 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/src/sosfilt.cc 2022-04-23 13:21:25.000000000 +0200
@@ -55,12 +55,6 @@
Matrix sos( args(0).matrix_value() );
- if (error_state)
- {
- err_wrong_type_arg ("sosfilt", args(0));
- return retval;
- }
-
if (sos.columns() != 6)
{
error("Second-order section matrix must be a non-empty Lx6 matrix");
@@ -69,12 +63,6 @@
Matrix x( args(1).matrix_value() );
- if (error_state)
- {
- err_wrong_type_arg ("sosfilt", args(1));
- return retval;
- }
-
int n=x.rows();
int m=x.columns();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/signal-1.4.1/src/upfirdn.cc
new/signal-1.4.2/src/upfirdn.cc
--- old/signal-1.4.1/src/upfirdn.cc 2019-02-08 23:00:37.000000000 +0100
+++ new/signal-1.4.2/src/upfirdn.cc 2022-04-23 13:21:25.000000000 +0200
@@ -43,47 +43,25 @@
}
octave_idx_type Lh = h.numel ();
- const double r = p/(static_cast<double> (q));
const octave_idx_type Ly = ceil (static_cast<double> ((rx-1)*p + Lh) /
static_cast<double> (q));
MT y (Ly, cx, 0.0);
+ octave_idx_type zero = 0;
+
for (octave_idx_type c = 0; c < cx; c++)
- {
- octave_idx_type m = 0;
- while (m < Ly)
+ for (octave_idx_type m = 0; m < Ly; m++)
{
- const octave_idx_type n = floor (m/r);
+ const octave_idx_type n = (m * q) / p;
const octave_idx_type lm = (m * q) % p;
- octave_idx_type k = 0;
- typename MT::element_type accum;
- accum = 0.0;
- do
- {
- octave_idx_type ix = n - k;
- if (ix >= rx)
- {
- k ++;
- continue;
- }
-
- const octave_idx_type ih = k * p + lm;
- if ((ih >= Lh) | (ix < 0))
- break;
-
- accum += h (ih) * x (ix, c);
- k++;
- }
- while (1);
-
- y (m, c) = accum;
- m ++;
+ y (m,c) = 0.0;
+ for (octave_idx_type k = std::max (zero, n-rx+1);
+ k <= n && k*p + lm < Lh; k++)
+ y (m,c) += h (k*p + lm) * x (n-k, c);
}
- }
-
if (isrowvector)
y = y.transpose ();
@@ -107,51 +85,19 @@
}
ColumnVector h (args (1).vector_value ());
-
- if (error_state)
- {
- err_wrong_type_arg ("upfirdn", args(1));
- return retval;
- }
-
octave_idx_type p = args (2).idx_type_value ();
-
- if (error_state)
- {
- err_wrong_type_arg ("upfirdn", args(2));
- return retval;
- }
-
octave_idx_type q = args (3).idx_type_value ();
- if (error_state)
- {
- err_wrong_type_arg ("upfirdn", args(3));
- return retval;
- }
-
// Do the dispatching
if (octave::signal::isreal (args (0)))
{
Matrix x = args (0).matrix_value ();
- if (error_state)
- {
- err_wrong_type_arg ("upfirdn", args(0));
- return retval;
- }
-
Matrix y = upfirdn (x, h, p, q);
retval (0) = y;
}
else if (octave::signal::iscomplex (args (0)))
{
ComplexMatrix x = args (0).complex_matrix_value ();
- if (error_state)
- {
- err_wrong_type_arg ("upfirdn", args(0));
- return retval;
- }
-
ComplexMatrix y = upfirdn (x, h, p, q);
retval (0) = y;
}