MATLAB Excel Builder | ![]() ![]() |
Testing The Add-in
Before distributing the add-in, test it with a sample problem. Spectral analysis is commonly used to find the frequency components of a signal buried in a noisy time domain signal. In this example you will create a data representation of a signal containing two distinct components and add to it a random component. This data along with the output will be stored in columns of an Excel worksheet, and you will plot the time-domain signal along with the power spectral density.
Follow the steps outlined below to create the test problem.
<project-directory>\distrib
directory, select Fourier.xla
and click OK.
This add-in installs a menu item under the Excel Tools menu. You can display the Spectral Analysis GUI by selecting Tools->Spectral Analysis. Before invoking the add-in, create some data, in this case a signal with components at 15 and 40 Hz. Sample the signal for 10 seconds at a sampling rate of 0.01 sec. Put the time points into column A and the signal points into column B.
Creating the Data
Follow these steps to create the data.
"= A1 + 0.01"
.
"= SIN(2*PI()*15*A1) + SIN(2*PI()*40*A1) + RAND()"
. Repeat the drag procedure to copy this formula to all cells in the range B1:B1001.
Running the Test
Using the column of data (column B), test the add-in as follows:
The next figure shows the output.
Figure 4-21: Worksheet with Inputs and Outputs for Test Problem
The power spectral density reveals the two signals at 15 and 40 Hz.
![]() | Saving the Add-in | Package the Add-in | ![]() |