596 Chapter 10. Software for Data Analysis
Figure 10.1.20: A simple code written in the code editor of MATLAB.
Line 10-12:Set title and labels of the plot just generated.
Line 13-16: Calculate mean, median, maximum value, and standard devia-
tion of the data. The values are output on the standard output, which for
MATLAB is its command line interface. We did not need to compute these
values for this example and they are meant to demonstrate this capability of
MATLAB.
Line 17:Compute the FFT of the data.
Line 18: Compute the power spectral density from the real and imaginary
components computed in the previous step.
Line 19:Normalize the frequency and select one half of the transform since
the other half is the image copy of the first one.
Line 20:Set the first value to be zero since it is simply the sum of all values.
Line 21:Create another canvas to plot the second figure.
Line 22:Plot the power spectral density (see Fig.10.1.22).
Line 23-24:Set the title and x-axis label.