用matlab 绘制高斯噪声、椒盐噪声、泊松噪声的时域及频域
高斯噪声的时域和频域绘制:
% 生成高斯噪声
noise = randn(1, 1000);
% 绘制时域图像
subplot(2,2,1);
plot(noise);
title('高斯噪声时域图像');
% 绘制频域图像
subplot(2,2,2);
N = length(noise);
f = (-N/2:N/2-1)/N;
plot(f, abs(fftshift(fft(noise))));
title('高斯噪声频域图像');
椒盐噪声的时域和频域绘制:
% 生成椒盐噪声
noise = rand(1, 1000);
threshold = 0.05;
noise(noise < threshold) = 0;
noise(noise > 1-threshold) = 1;
% 绘制时域图像
subplot(2,2,3);
plot(noise);
title('椒盐噪声时域图像');
% 绘制频域图像
subplot(2,2,4);
N = length(noise);
f = (-N/2:N/2-1)/N;
plot(f, abs(fftshift(fft(noise))));
title('椒盐噪声频域图像');
泊松噪声的时域和频域绘制:
% 生成泊松噪声
noise = poissrnd(1, 1, 1000);
% 绘制时域图像
subplot(2,2,1);
plot(noise);
title('泊松噪声时域图像');
% 绘制频域图像
subplot(2,2,2);
N = length(noise);
f = (-N/2:N/2-1)/N;
plot(f, abs(fftshift(fft(noise))));
title('泊松噪声频域图像');
``
原文地址: https://www.cveoy.top/t/topic/fayW 著作权归作者所有。请勿转载和采集!