用matlab滤除随机噪声的算法
来源:百度知道 编辑:UC知道 时间:2024/05/22 18:35:02
% Denoising.m
%
% by Brigitte Forster,
% Centre of Mathematical Sciences
% Munich University of Technology, Germany
%
% Version: March 17 2005
%
% This File shows an example for denoising
% via hard thresholding of Fourier coefficients.
% It is part of the summer term lecture on
% Fourier- and Laplace transform at TUM.
% Threshold festlegen
thresholdstep = 0.01;
% Varianz des normalverteilten Rauschens festlegen
sigma = 3;
% Signal erzeugen
M = 400;
x = -pi:(2*pi/(M-1)):pi;
forig = sin(6*x);
f = forig + sigma*(rand(size(x))-0.5);
figure(1)
subplot(2,2,1)
hold on
plot(x,f)
plot(x, forig,'r-')
axis tight;
hold off
% Fourier-Koeffizienten berechnen
ff = fft(f)/M;
ff = fftshift(ff);
x0 = x/(2*pi)*M;
subplot(2,2,2)
plot(x0,abs(ff),'.','LineWidth', 3)