wavework.m

%wavework源函数function [varargout]=wavework(opcode,type,c,s,n,x)
%wavework用来编辑小波重构结构的。
%建立在opcode的type和n去获取或修改得到一个指定的系数%输入:
%opcode          执行程序
%'copy'             [varargout]=y=requested(通过type和n)系数矩阵
%'cut'                [varargout]=[nc,y]得到新的重构向量(零系数矩阵)和系数矩阵
%'paste'            [varargout]=[nc]通过替换x得到新的带有系数矩阵的新重构向量%type                系数类型
%'a'                    近似值系数
%'h'                    水平细节
%'v'                    垂直细节
%'d'                    对角线细节%[c,s]是一个小波工具重构结构。n是重构水平(type='a'则忽略)。x是为粘贴用的二维系数矩阵error(nargchk(4,6,nargin));if (ndims(c)~=2) | (size(c,1)~=1)error('C must be a row vector.')
endif (ndims(s)~=2 | ~isreal(s) | isnumeric(s) | (size(s,2)) ~=2error('S must be a real,numeric two-column array.');
endelements=prod(s,2);%系数矩阵元素
if (length(c)=elements(end))error(['[c,s] must be a standard wavelet decomsition' 'structure.']);
endif nargin<5,n=1;%默认水平为1
end
nmax=size(s,1)-2;%最大水平为[c,s]
aflag=(lower(type(1))=='a');
if ~aflag & (n>nmax)error('N exceeds the decomposition in [c,s].');
endswitch lower(type(1))%将指针转为1case 'a' nindex=1;start=1;stop=elements(1);ntst(1);ntst=nmax;case{'h','v','d'}switch typecase 'h',offset=0;%细节的补偿值case 'v',offset=1;case 'd',offset=2;endnindex=size(s,1)-n;%索引到详细信息start=elements(1)+3*sum(elements(2:nmax-n+1))+offset*elements(nindex)-1;stop=start+elements(nindex)-1;ntst=n;otherwiseerror('TYPE must begin with ''a'',''h'',''v'',or''d''.');
endswitch lower(opcode)%需求反应case{'copy','cut'}y=repmat(0,s(nindex,:));y(:)=c(start:stop);nc=c;if strcmp(lower(opcode(1:3)),'cut')nc(start:stop)=0;varargout={nc,y};elsevarargout={y};endcase'paste'if prod(size(x)) ~=elements(end-ntst)error('X is not sized for the requested paste.');elsenc=c;nc(start:stop)=x(:);varargout={nc};endotherwiseerror('Unrecognized OPCODE.')
end


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部