Add impulsive noise generated by ε mixture of Gaussian noise

조회 수: 3 (최근 30일)
Sabaudian
Sabaudian 2022년 7월 2일
답변: Abhimenyu 2023년 10월 6일
I have to add noise to a signal following a function on a scientific paper. The noise, like specified in the title, is generated by ε mixture of Gaussian noise that has a porbability density function of:
I have try to translate this function into a code, and I think that is right, but I am very insecure about this kind of things and I want to be 100% sure that what I have done is correct.
Explanation of the function: ϕ(y) is the probability density function of a Gaussian random variable with zero mean and unit variance. σ2 is tipically much larger than σ1. ε is a weight, wich controls the distribution of the two ϕ, the background noise and the impulse noise, respectively.
My Attempt:
clc;
close all;
clear;
load("100m.mat"); % load signal
y = val; % MY Signal
L = length(y); % length of the signal
E = 0.1 + (0.5).*rand(1); % epsilon (range 0.1-0.5)
s_1 = 10; % sigma1 (σ1)
s_2 = 100; % sigma2 (σ2)
noise = (1-E)*s_1.*randn(L) + E*s_2.*randn(L); % generated noise
yn = y + noise; % noisy signal
  댓글 수: 1
Sabaudian
Sabaudian 2022년 7월 3일
I'm just asking for a check. I just need to know if what I wrote is right or wrong. thank you

댓글을 달려면 로그인하십시오.

채택된 답변

Abhimenyu
Abhimenyu 2023년 10월 6일
Hi Sabaudian,
I understand that you want to add noise to your signal according to the given equation. The provided code does not implement the gaussian random vector correctly. Please refer to the code below for better understanding:
clc;
clearvars;
load("100m.mat"); % load signal
y = val; % MY Signal
L = length(y); % length of the signal
E = 0.1 + (0.5 - 0.1) * rand % Random value of k between 0.1 and 0.5
s1 = 10; % Value of s1
s2 = 100; % Value of s2
% Generate noise based on the probability density function
f = @(y, s) exp(-(y.^2) ./ (2 * s)) ./ (sqrt(2 * pi*s));
% Gaussian probability density function
noise = (1 - E) * f(y / s1, 1/(s1^2)) + E * f(y / s2, (1/s2^2));
% Calculate the noise based on the given PDF, phi(y) has 0 mean and unit var, so phi(y/s) will have 0 mean and 1/s^2 var
% Add noise to the signal
yn = y + noise; % noisy signal
I hope this helps!
Thank you,
Abhimenyu.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by