In matlab how do I write u(n) in order to get the autocorrelation?

AI Thread Summary
To compute the autocorrelation of the signal u(n) defined as u(n) = 0.4s(n) + 0.7s(n) - 0.1s(n-2) + v(n) in MATLAB, the user needs to properly code the function u(n) for input into the xcorr function. The challenge lies in ensuring that v(n), which is zero mean with a variance of 0.003, remains uncorrelated with s(n). The user has already calculated the autocorrelation values by hand, finding r(k) = 0.663 for k=0, 0.21 for k=1, and -0.04 for k=2, with zeros for other k values. Suggestions include using MATLAB's built-in functions and ensuring proper representation of v(n) to maintain its uncorrelated nature with s(n). Proper coding will facilitate the desired autocorrelation analysis.
nikki92
Messages
37
Reaction score
0

Homework Statement



u(n) = .4s(n)+.7s(n) -.1s(n-2)+v(n) where v(n) is zero mean and has variance 0.003 and uncorrelated with s(n)

I want the autocorrelation is E[u(n-k)u(n)] I can solve it easily by hand which is the follow
so r(k) = 0.663 for k =0, 0.21 for k=1 , -0.04 for k=2 and the rest are zeros.

The Attempt at a Solution


In MATLAB how do I write u(n) in order to get the autocorrelation?
 
Physics news on Phys.org
Did you try the built in MATLAB function 'XCorr' ?
 
I am not having trouble getting a function for auto-correlation, I am just not sure how to code u(n) in a way to input it into xcorr, also how would I represent v(n) in a way so it remains uncorrelated with s(n).
 
Back
Top