📄 tfmat.m
字号:
function F=tfmat(ttype,p2,p3,p4,p5)%TFMAT Matrix of transform / operator% Usage: F=tfmat('fourier',L);% F=tfmat('dcti',L);% F=tfmat('dgt',g,a,M);% F=tfmat('dwilt',g,M);% F=tfmat('mdct',g,M);% F=tfmat('zak',L,a);%% TFMAT returns a matrix F containing the basis functions / atoms of% one of the transforms in the toolbox. The atoms are placed as column% vectors in the matrix. A forward transform (analysis) can be done by% % c=F'*f;% % and a backwards or adjoint transform (synthesis) can be done by% % r=F*c;% % The possibilities are:%% TFMAT('fourier',L) returns the matrix of the unitary Fourier% transform of length L. See DFT.%% TFMAT('dcti',L) returns the matrix of the DCTI transform of length% L. Similarly for 'dctii', 'dctiii', 'dctiv', 'dsti', 'dstii',% 'dstiii' or 'dstiv'%% TFMAT('dgt',g,a,M) returns a matrix containing all the atoms of the% Gabor frame with window g and lattice constants a and M. % TFMAT('dgt',g,a,M,L) will do the same for a FIR window g.%% TFMAT('dwilt',g,M) returns a matrix containing all the atoms of the% Wilson basis with window g and M channels. TFMAT(g,M,L) will do the% same for a FIR window g.%% TFMAT('mdct',g,M) and TFMAT('mdct',g,M,L) does the same for an MDCT% with M channels.%% TFMAT('spread',c) and TFMAT('spread',c,a) returns the matrix of the% spreading operator with symbol c.%% TFMAT('zak',L,a) returns the transform matrix for a Zak transform of% length L and parameter a.% % This function should mainly be used for educational purposes or for % experimenting with systems, as the generated matrix can% become very large.%% SEE ALSO: DFT, DCTI, DSTI, DGT, DWILT, MDCT% 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/>.if (nargin<1) || ~ischar(ttype) error('You must specify the transform type')end;switch(lower(ttype)) case {'fourier','dft'} error(nargchk(2,2,nargin)); F=idft(eye(p2)); case {'dcti'} error(nargchk(2,2,nargin)); F=dcti(eye(p2)); case {'dctii'} error(nargchk(2,2,nargin)); F=dctiii(eye(p2)); case {'dctiii'} error(nargchk(2,2,nargin)); F=dctii(eye(p2)); case {'dctiv'} error(nargchk(2,2,nargin)); F=dctiv(eye(p2)); case {'dsti'} error(nargchk(2,2,nargin)); F=dsti(eye(p2)); case {'dstii'} error(nargchk(2,2,nargin)); F=dstiii(eye(p2)); case {'dstiii'} error(nargchk(2,2,nargin)); F=dstii(eye(p2)); case {'dstiv'} error(nargchk(2,2,nargin)); F=dstiv(eye(p2)); case {'gabor','dgt'} error(nargchk(4,5,nargin)); g=p2; if nargin==4 L=length(g); else L=p5; end; a=p3; M=p4; N=L/a; c=reshape(eye(M*N),M,N,M*N); F=idgt(c,g,a); case {'wilson','dwilt'} error(nargchk(3,4,nargin)); g=p2; if nargin==3 L=length(g); else L=p4; end; M=p3; N=L/M; c=reshape(eye(M*N),2*M,N/2,M*N); F=idwilt(c,g); case {'mdct'} error(nargchk(3,4,nargin)); g=p2; if nargin==3 L=length(g); else L=p4; end; M=p3; N=L/M; c=reshape(eye(M*N),M,N,M*N); F=imdct(c,g); case {'spread'} error(nargchk(2,3,nargin)); c=p2; if nargin==2 a=1; else a=p3; end; L=size(c,2)*a; F=spreadop(eye(L),c); case {'gabmul'} error(nargchk(5,5,nargin)); c=p2; g=p3; a=p4; M=p5; L=length(g); N=L/a; F=gabmul(eye(L),c,g,a); case {'zak'} error(nargchk(3,3,nargin)) L=p2; a=p3; N=L/a; c=reshape(eye(L),a,N,L); F=izak(c); otherwise error('Unknown transform.');end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -