To see the output from the examples, copy the examples to a worksheet and execute the worksheet. For information on accessing MATLAB® from Maple, see Matlab/setup.
Generate some data for analysis.
>
|
|
>
|
|
>
|
|
Add noise to the data.
>
|
|
>
|
|
Use MATLAB® to calculate the Fourier Transform.
>
|
|
Check whether this is a complex Vector.
>
|
|
Split it into parts.
>
|
|
>
|
|
How big is the returned value?
The length is the same as the defined variable 'num' .
To calculate the power spectrum, you need ft * conj(ft) /n. To do this in MATLAB®, first put 'ft' into the MATLAB® memory.
Calculate the desired result with evalM, ensuring the result is assigned to a variable so that the Matlab[getvar] command can be used.
>
|
|
Get the result.
>
|
|
Note that this result is not complex.
>
|
|
Plot the power spectrum. You must convert 'pwr' to a list in this case.
>
|
|
Due to symmetry, you must plot only the first half of the values.
>
|
|
>
|
|
There are two obvious frequencies. The dominant frequency is:
>
|
|
So the period is:
Find the secondary frequency. From the plot, you see that it is past t1.
>
|
|
>
|
|
So the secondary period is:
Note that T1 and T2 are close to the angle multipliers in the original equation, which is expected.