请教高手用matlab编程(平均法)

2025-06-22 02:54:01
推荐回答(1个)
回答1:

200个点,得到5个土,分别是原图,加噪声图,以及三种去噪方法结果图.

N=200;
k = 1:N;
noise_mu = 0;
noise_var =0.05;
n = randn(1,N) .* sqrt(noise_var) + noise_mu;

s = sin(pi./4.*k);
x = sin(pi./4.*k) + n;

subplot(5,1,1);
plot(s);
subplot(5,1,2);
plot(x);

%1 average
y1=x;
subplot(5,1,3);
plot(y1);

%10 average
f = ones(1,10);
y2=conv(x, f);
subplot(5,1,4);
plot(y2(10/2:end-10/2));

%100 average
f = ones(1,100);
y2=conv(x, f);
subplot(5,1,5);
plot(y2(100/2:end-100/2));