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 Center および File ExchangeCorrelation and Convolution についてさらに検索

製品


リリース

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by