Mercurial > hg > octave-nkf
diff scripts/signal/synthesis.m @ 11469:c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 09 Jan 2011 12:41:21 -0800 |
parents | a1dbe9d80eee |
children | 1740012184f9 |
line wrap: on
line diff
--- a/scripts/signal/synthesis.m +++ b/scripts/signal/synthesis.m @@ -33,7 +33,7 @@ ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> ## Description: Recover a signal from its short-term Fourier transform -function X = synthesis (Y, c) +function x = synthesis (y, c) if (nargin != 2) print_usage (); @@ -44,31 +44,30 @@ error ("synthesis: c must contain exactly 3 elements"); endif - ## not necessary, enables better reading - win = c(1); - inc = c(2); + w_size = c(1); + inc = c(2); w_type = c(3); if (w_type == 1) - H = hanning (win); + w_coeff = hanning (w_size); elseif (w_type == 2) - H = hamming (win); + w_coeff = hamming (w_size); elseif (w_type == 3) - H = ones (win, 1); + w_coeff = ones (w_size, 1); else error ("synthesis: window_type must be 1, 2, or 3"); endif - Z = real (ifft (Y)); - st = fix ((win-inc) / 2); - Z = Z(st:st+inc-1, :); - H = H(st:st+inc-1); + z = real (ifft (y)); + st = fix ((w_size-inc) / 2); + z = z(st:st+inc-1, :); + w_coeff = w_coeff(st:st+inc-1); - nc = columns(Z); + nc = columns(z); for i = 1:nc - Z(:, i) = Z(:, i) ./ H; + z(:, i) = z(:, i) ./ w_coeff; endfor - X = reshape(Z, inc * nc, 1); + x = reshape(z, inc * nc, 1); endfunction