www.gusucode.com > signal 案例源码程序 matlab代码 > signal/WalshTransformOfASignalExample.m
%% Walsh-Hadamard Transform of a Signal % This example shows a simple input signal and its Walsh-Hadamard % transform. % Copyright 2015 The MathWorks, Inc. %% x = [19 -1 11 -9 -7 13 -15 5]; y = fwht(x) %% % |y| contains nonzero values at locations 0, 1, 3, and 6. Form the Walsh % functions with the sequency values 0, 1, 3, and 6 to recreate x. w0 = [1 1 1 1 1 1 1 1]; w1 = [1 1 1 1 -1 -1 -1 -1]; w3 = [1 1 -1 -1 1 1 -1 -1]; w6 = [1 -1 1 -1 -1 1 -1 1]; w = y(0+1)*w0 + y(1+1)*w1 + y(3+1)*w3 + y(6+1)*w6