representing the correlation function

조회 수: 3 (최근 30일)
Mosanu Cristina Alina
Mosanu Cristina Alina 2022년 1월 7일
댓글: Jon 2022년 1월 7일
The discrete signal is disturbed by a random noise. To calculate the autocorrelation of the disturbed signal, I wrote the code:
n=0:27;
x=sin(pi*(1/7)*n);
w=randn(1,length(x)); % noise
y=x+w;
[r,lag]=xcorr(y,y);
stem(lag,r)
But I'm not sure if the noise parameters are well chosen.

답변 (1개)

Jon
Jon 2022년 1월 7일
In your code the sin wave signal will have an amplitude of one, and the stadard deviation of the noise signal will also be one.
If you want a different signal to noise ratio, you can scale the noise signal, for example to have a standard deviation of 0.1 you could use
w= 0.1*randn(1,length(x)); % noise
By the way, to get your code formatted nicely and to make it easy for others to cut and paste it you can use the code button on the MATLAB answers toolbar
  댓글 수: 2
Mosanu Cristina Alina
Mosanu Cristina Alina 2022년 1월 7일
but what I don't understand is, at the noise, what parameters can I take? And the disturbed signal is given by the sum of the initial signal and the noise?
Jon
Jon 2022년 1월 7일
I'm not really understanding what your questions mean. Could you please try to explain further. What is it that you are actually trying to do.
In case it helps here's a couple of points that I think may relate to what you are asking.
There are many ways to model noisy signals. The appropriate noise model, depends upon the physics of the application. Without assuming any specific details, one of the simplest is to consider the signal to be a linear sum of the original signal and some "additive" noise. So as in you above script, you create a noise signal w using a noise signal w and add it to the original signal using:
y=x+w;
Regarding the noise signal, in the absence of any further knowledge of the spectrum or characteristics of the noise a simple model is to just consider it as samples from a gaussian (normally distribution) characterized by a wbar and standard deviation sd, so you could use
sd = 0.1 % or whatever value you choose for the standard deviation
wbar = 0.3 % or whatever value you choose for the mean value
w = wbar + sd*randn(1,length(x))
In your original code, you have implicitly chosen sd = 1 and wbar = 0.

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

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by