homework5_14s

advertisement
KAAP686 Homework 5
1 When computing power spectra in Matlab or Excel, the user must supply the “frequency spacing”, i.e.
the “delta f”, between adjacent frequencies in the spectrum. The third column below indicates how the
signal analyst “chops up” the signal into equal length segments, and then computes a spectrum for each
segment. For example, if the signal duration (column 2) is 10 seconds, and the number of nonoverlapping segments (column 3) is 5, then the length of each segment is 2 seconds.
Fill in columns 4 and 5 of the following table.
Number of nonSampling rate Signal duration
overlapping
(Hz)
(s)
segments
2
10
50
1
10
300
1
10
300
10
1080
5
1
1080
5
5
2000
12
8
5000
12
8
Δf
(Hz)
Nyquist frequency
(Hz)
File 0211_NS_1_ratemid.txt is a record of heart rate, in beats per second, determined from the R-R
intervals, interpolated and sampled at 10 Hz. The record is 314 seconds long. We can call the signal
x(k).
2A Calculate the one-sided power spectrum X(f), using the full data record (i.e. without segmenting or
averaging), and with no windowing. Make two plots: one using a logarithmic vertical-axis scale, and
showing all frequencies from 0 to Nyquist; the other using a linear vertical axis scale and showing
frequencies from 0 to 1 Hz. Make sure the frequency labels on the horizontal axis are correct.
2B Repeat 2A, but subtract the linear trend from the data record before computing the spectrum. In
other words, fit a straight line through x(k), and subtract that straight line from x(k). This should give
you a data record whose mean is zero and which has no net up or down trend. Make two plots, like
the two plots in 2A. What difference, if any, do you notice between the corresponding plots with
and without the trend removal (2B versus 2A)?
2C Repeat 2B, but apply a Hanning window to the time-domain data after subtracting the linear trend,
and before computing the spectrum. Remember to multiply the spectrum values by a correction
factor to compensate for the power lost due to windowing. The proper correction factor was
discussed in class and in the notes. Make two plots, like the two plots in 2A and 2B. What
difference, if any, do you notice between the corresponding plots with and without the Hanning
window (2C versus 2B)?
3A Use file 2011_NS_1_ratemid.txt, as in the previous problem. Divide the data into 4 equal length
non-overlapping segments, plus 3 half-overlapped segments, as discussed in class. Since the original
record is approximately 314 seconds long, each segment will be about 78.5 seconds long. Before
computing the spectrum of each segment, remove the linear trend and apply a Hanning window, as
in 2C. Compute the average power spectrum by averaging the power spectra of all 7 segments. You
can multiply each segment’s spectrum by the Hanning window correction factor, or you can apply
the correction factor to the final average spectrum – you’ll get the same answer either way. Just
remember to do one or the other. And make sure you get the frequency axis correct. Segmenting
the data changes the “delta f”. Labview figures out delta f for you, but if you use Matlab, you must
figure it out. Make a plot of the power spectrum from 0 to 1 Hz, using a linear scale for the vertical
axis. This is analogous to one of the plots you made for 2C, except the data has been segmented
and power spectra have been averaged together.
3B Same as 3A, but with 8 equal length segments, plus 7 non-overlapping segments. Each segment will
be about 39 seconds long. Make a plot of the power spectrum from 0 to 1 Hz, using a linear scale
for the vertical axis, like the plot for 3A. Make sure you get delta f correct. Comment on what
differences you notice between the plots of 3A and 3B and the 0-to-1 Hz plot of 2C.
Download