- 1,749

- 65

I'm following a tutorial in MATLAB, shown here

Code:

```
t = 0:.001:.25;
x = sin(2*pi*50*t) + sin(2*pi*120*t);
y = x + 2*randn(size(t));
Y = fft(y,251);
Pyy = Y.*conj(Y)/251;
f = 1000/251*(0:127);
plot(f,Pyy(1:128))
title('Power spectral density')
xlabel('Frequency (Hz)')
```

Line 4: why use the 251 part of the transform?

Line 5: Why this rather than, say Norm(Y)?

Line 6: so the 1000 is evidently from line 1, the time step? But where is the 251 coming from; looks like it's the time step * end time + 1.

Thanks!