📄 stftlong.m
字号:
% STFTLONG.M
% STFTLONG
% Function X = stftlong(x,w,a,b);
% Description : STFTLONG(...) determines the STFT of a long signal x with
% respect to a window w over a lattice with lattice constants
% a (time) and b (frequ).
% Input : x=a vector representing the function (size n)
% w=a vector representing the window function
% a,b=two integers representing the lattice constants
% (they must be dividers of n)
% Output : X=a new matrix (size n*n when no lattice constants are
% given, size (n/a)*(n/b) otherwise)
% Usage : stftlong(x,w); to have a stft with a=b=1
% stftlong(x,w,a,b);
% See also : STFT
%
% ---------------------------------------------------------------
%
% COPYRIGHT : (c) NUHAG, Dept.Math., University of Vienna, AUSTRIA
% http://nuhag.eu/
% Permission is granted to modify and re-distribute this
% code in any manner as long as this notice is preserved.
% All standard disclaimers apply.
%
% STFTLONG
% Function X = stftlong(x,w,a,b);
% Description : STFTLONG(...) determines the STFT of a long signal x with
% respect to a window w over a lattice with lattice constants
% a (time) and b (frequ).
% Input : x=a vector representing the function (size n)
% w=a vector representing the window function
% a,b=two integers representing the lattice constants
% (they must be dividers of n)
% Output : X=a new matrix (size n*n when no lattice constants are
% given, size (n/a)*(n/b) otherwise)
% Usage : stftlong(x,w); to have a stft with a=b=1
% stftlong(x,w,a,b);
% See also : STFT
% uses symmetric extension of signal at boundaries
function X = stftlong(x,w,a,b)
if nargin < 3; a = 1; b = 1; end;
l = length(x);
n = length(w);
% check if length of window divides length of signal
nl = l/n;
if rem(nl,1) ~= 0;
nn = n*ceil(nl) - l;
end
na1 = floor((n-a)/2);
na2 = ceil((n-a)/2);
% simple zero padding for taking care of boundary effects
% maybe an antisymmetric extension should be carried out
xx = [x(na1:-1:1) x x(l:-1:l-na2+1)];
ll = length(xx);
coeff = zeros(1+(ll-n)/a,n/b);
for jj = 1:1+(ll-n)/a;
x = xx((jj-1)*a+1:(jj-1)*a+n);
y = x.* w;
y1 = perbas(y,b);
v = fft(y1);
coeff(jj,:) = v;
end;
[mm,nn] = size(coeff);
X = coeff.';
%X = rot(X,l/2+1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -