BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / matlab / #9736同步于 2013/3/25
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Matlab机器人发帖

[问题]MATLAB MCLT 变换指导

duanruihong
2013/3/25镜像同步3 回复
看到论文里面有一段音频水印方面的MATLAB程序 function y = fimclt(X) % FIMCLT - Compute IMCLT of a vector via double-length FFT % % H. Malvar, September 2001 -- (c) 1998-2001 Microsoft Corp. % % Syntax: y = fimclt(X) % % Input: X : complex-valued MCLT coefficients, M subbands % % Output: y : real-valued output vector of length 2*M % in Matlab, by default j = sqrt(-1) % determine # of subbands, M M = length(X); % allocate vector Y Y = zeros(2*M,1); % compute modulation function k = [1:M-1]'; c = W(8,2*k+1) .* W(4*M,k); % map X into Y Y(2:M) = (1/4) * conj(c) .* (X(1:M-1) - j * X(2:M)); % determine first and last Y values Y(1) = sqrt(1/8) * (real(X(1)) + imag(X(1))); Y(M+1) = - sqrt(1/8) * (real(X(M)) + imag(X(M))); % complete vector Y via conjugate symmetry property for the % FFT of a real vector (not needed if the inverse FFT % routine is a "real FFT", which should take only as input % only M+1 coefficients) Y(M+2:2*M) = conj(Y(M:-1:2)); % inverse normalized FFT to compute the output vector % output of ifft should have zero imaginary part; but % by calling real(.) we remove the small rounding noise % that's present in the imaginary part y = real(ifft(sqrt(2*M) * Y)); return; % Local function: complex exponential function w = W(m,r) w = exp(-j*2*pi*r/m); return; 敲进MATLAB中之后提示我有一句话 c = W(8,2*k+1) .* W(4*M,k); 中的.*不符合规范,删掉.保留*之后 提示内存爆掉。求大神指导!
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
zzz2012机器人#1 · 2013/3/25
多长的数据?
duanruihong机器人#2 · 2013/3/27
进来的是一段音频,应该是很长,仔细检查了一下输入输出,应该是没错,音频进来是个 2*M的矩阵。。
duanruihong机器人#3 · 2013/3/27
噢。。这是逆变换的。。 正变换的如下 function X = fmclt(x) % FMCLT - Compute MCLT of a vector via double-length FFT % % H. Malvar, September 2001 -- (c) 1998-2001 Microsoft Corp. % % Syntax: X = fmclt(x) % % Input: x : real-valued input vector of length 2*M % % Output: X : complex-valued MCLT coefficients, M subbands % in Matlab, by default j = sqrt(-1) % determine # of subbands, M L = length(x); M = L/2; % normalized FFT of input U = sqrt(1/(2*M)) * fft(x); % compute modulation function k = [0:M]'; c = W(8,2*k+1) .* W(4*M,k); % modulate U into V V = c .* U(1:M+1); % compute MCLT coefficients X = j * V(1:M) + V(2:M+1); return; % Local function: complex exponential function w = W(M,r) w = exp(-j*2*pi*r/M); return;