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

In summary, the conversation is about finding the autocorrelation of u(n), which is a function of s(n) and v(n). The values of s(n) and v(n) are given, as well as the desired autocorrelation values for different values of k. The question is about how to code u(n) and v(n) in MATLAB in order to use the 'XCorr' function and ensure that v(n) remains uncorrelated with s(n).
  • #1
nikki92
40
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
  • #2
Did you try the built in MATLAB function 'XCorr' ?
 
  • #3
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).
 

1. What is u(n) in MATLAB?

In MATLAB, u(n) is a function that generates a unit step signal. This signal has a value of 0 for all negative values of n, and a value of 1 for all positive values of n.

2. How do I write u(n) in MATLAB code?

To write u(n) in MATLAB, you can use the heaviside function. This function takes in a value of n and returns 0 if n is negative, and 1 if n is positive.

3. What is autocorrelation in MATLAB?

In MATLAB, autocorrelation is a measure of the similarity between a signal and a time-delayed version of itself. It is commonly used in signal processing and time series analysis to identify patterns and relationships in data.

4. How do I calculate autocorrelation in MATLAB?

To calculate autocorrelation in MATLAB, you can use the xcorr function. This function takes in two signals and returns the cross-correlation between them. For autocorrelation, you can input the same signal twice.

5. How do I plot the autocorrelation function in MATLAB?

To plot the autocorrelation function in MATLAB, you can use the xcorr function in combination with the plot function. The xcorr function will return the autocorrelation values, and the plot function can be used to create a graph of these values.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Advanced Physics Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
2K
Replies
3
Views
1K
  • Differential Equations
Replies
1
Views
748
  • Programming and Computer Science
Replies
15
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
995
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
Back
Top