Add impulsive noise generated by ε mixture of Gaussian noise
3 views (last 30 days)
Show older comments
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
Accepted Answer
Abhimenyu
on 6 Oct 2023
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 Comments
More Answers (0)
See Also
Categories
Find more on Sources in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!