separatecoeff.sci

来自「小波分解源代码」· SCI 代码 · 共 40 行

SCI
40
字号
function [rtrigcoefs, itrigcoefs] = SeparateCoeff(wcoefs,windows)
// SeparateCoeff -- Separate wavelet coeff. into local trig. coeff.
//  Usage
//    [rtrigcoefs, itrigcoefs] = SeparateCoeff(wcoefs,windows)
// Inputs
//   wcoefs       wavelet coefficients for a given level.
//   windows      string selecting window for projection.
//                'm' -> mother, 'f' -> father, 't' -> truncated mother
// Outputs
//   rtrigcoefs   trigonometric coefficients corresponding to
//                   projection of real part of \hat f
//   itrigcoefs   trigonometric coefficients corresponding to
//                   projection of imag part of \hat f
// See Also
//   CoarseMeyerProj, DetailMeyerProj, FineMeyerProj
//
//  Copyright Aldo I Maalouf

	nj   = length2(wcoefs);
	nj1  = nj/2;
	
	if windows == 'm',
	  rtrigcoefs = (-1).^(1:(nj1)).*(waverow(wcoefs(1:nj1)) + waverow(wcoefs(nj:-1:(nj-nj1+1)))) ./ 2 ;
	  itrigcoefs = (-1).^(1:(nj1)).*(waverow(wcoefs(1:nj1)) - waverow(wcoefs(nj:-1:(nj-nj1+1)))) ./ 2 ;
	elseif windows == 'f',
	  rtrigcoefs = (-1).^(1:nj-1) .* [ waverow(wcoefs(2:nj)) + waverow(wcoefs(nj:-1:2)) ] / sqrt(2) ;
	  rtrigcoefs = [ 2*wcoefs(1)  rtrigcoefs ];
	  itrigcoefs = (-1).^(2:nj) .* [ waverow(wcoefs(2:nj)) - waverow(wcoefs(nj:-1:2)) ] / sqrt(2) ;
	elseif windows == 't',
	  rtrigcoefs = (-1).^(1:nj1).*(waverow(wcoefs(1:nj1)) + waverow(wcoefs(nj:-1:(nj-nj1+1)))) ./ 2 ;
	  itrigcoefs = (-1).^(1:nj1).*(waverow(wcoefs(1:nj1)) - waverow(wcoefs(nj:-1:(nj-nj1+1)))) ./ 2 ;
	else 
	'windows given was not m, f, or t !'
	end
	endfunction



    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?