- added Wiener stuff

git-svn-id: http://moon:8086/svn/matlab/trunk@40 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
2015-04-29 19:23:29 +00:00
parent 46640e7e4e
commit b3924ead7d
5 changed files with 152 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
function [xs, g, PSDx, PSDy] = wiener_fd(x, y, sigma_noise)
N = length(x);
Y = fft(y);
X = fft(x);
PSDx = 1/N*abs(X).^2; % spectral power
PSDy = 1/N*abs(Y).^2; % spectral power
k = sqrt(sum(PSDx)./sum(PSDy))
% fourier transform of the wiener filter
G = PSDx./(PSDx + sigma_noise.^2);
% perform the filtering over the fourier
G = 1/k*G.*PSDx./PSDy;
xs = ifft(G.*Y);
g = ifft(G);