a = rand(1, 512); plot(a); b = rand(1, 512); A = fft(a); B = fft(b); C = fft(cconv(a,b, 512)); norm(A .*B - C) % check convolution theorem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load gong.mat y = y(1:40000); % Note y is a column vector sound(y, Fs) YY = fft(y'); % fft of transpose to get row vectors plot(abs(YY).^2) F1 = [zeros(1, 5000) ones(1, 30000) zeros(1,5000)]; plot(F1) ylim([-.1,1.1]) F2 = ones(1,40000) - F1; plot(F2) ylim([-.1,1.1]) Z1 = YY.* F1; % only central portion Z2 = YY.* F2; % only edge portion plot(abs(Z1).^2) plot(abs(Z2).^2) z1 = real(ifft(Z1)); % get rid of small imag parts from roundoff z2 = real(ifft(Z2)); sound(z1, Fs) % only high freq remain sound(z2, Fs) % so edges are low freq plot(abs(fftshift(YY)).^2) % move low freq to middle.