# Autocorrelation and spectral density in MATLAB

This question is twofold.

We have an LTI system that is a first degree Butterworth LP filter with the power TF

where fu = 110Hz and f1 = 90Hz

The input X(t) has the autocorrelation: R_X(\tau) = 5e^{-600|\tau|}

1) How can I calculate the power spectral density of the output in MATLAB? FFT? How do I represent the autocorrelation as a vector?

2) How can I simulate the system and plot the output in MATLAB?

-

## migrated from stackoverflow.comApr 13 '14 at 22:13

This question came from our site for professional and enthusiast programmers.

possible duplicate of Calculate autocorrelation using FFT in matlab – tashuhka Apr 12 '14 at 13:58
I thought I had posted this in math.stackexhange, oh well. – user2750354 Apr 12 '14 at 17:12

To calculate the Autocorrelation of the output:

R_y = xcorr(y); % with Y(f) = X(f).H(f) or y(t) = x(t)*h(t)


To calculate the P.S.D of the output:

PSD_y = fft (R_y);


To reprensent them graphically, you can use plot

if you do not have the x(t) or X(f) expressions, you could use this relation:

PSD_y (f) = PSD_x (f) . |H(f)|^2  % with PSD_x (f) = fft(R_x);

-
I have the autocorrelation of X, but I don't know the actual x. How can I do this given the autocorrelation? – user2750354 Apr 12 '14 at 11:50
see my updated answer, and let me know if it worked. thx – Madhatter Apr 12 '14 at 13:59