changeset 2796:c4da0d1725b7 octave-forge

Inverse discrete sine transform
author pkienzle
date Tue, 05 Dec 2006 20:45:43 +0000
parents 7a614782378d
children f5d38c6642ab
files main/signal/inst/idst.m
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/signal/inst/idst.m	Tue Dec 05 20:45:43 2006 +0000
@@ -0,0 +1,31 @@
+## x = idst (y, n)
+##    Computes the inverse type I discrete sine transform of y.  If n is 
+##    given, then y is padded or trimmed to length n before computing 
+##    the transform.  If y is a matrix, compute the transform along the 
+##    columns of the the matrix.
+##
+## See also: idst
+
+## This program is public domain
+
+## Author: Paul Kienzle
+## 2006-12-05
+##   * initial release
+function x = idst (y, n)
+
+  if (nargin < 1 || nargin > 2)
+    usage ("x = idst(y [, n])");
+  endif
+
+  if nargin == 1,
+    n = size(y,1);
+    if n==1, n = size(y,2); end
+  end
+  x = dst(y, n) * 2/(n+1);
+
+endfunction
+
+
+%!test
+%! x = log(gausswin(32));
+%! assert(x, idst(dst(x)), 100*eps)