User`s guide
Spectral Analysis Example
The program does the following:
• Constructs an input array with values representing a random signal
with two sinusoids at 15 and 40 Hz embedded inside of it
• Creates an
MWNumericArray array that contains the data, as shown:
data = MWNumericArray.newInstance(dims, MWClassID.DOUBLE, MWComplexity.REAL);
• Instantiates a fourier object
• Calls the
plotfft method, w hich calls computeftt and plots the data
• Uses a
try/catch block to handle exceptions
• Frees native resources using
MWArray methods
7 Compile the powerspect.java application using javac.
a. Open a Command P rompt window and
cd to the
matlabroot\work\spectralanalysis directory.
b. On Windows, execute the fo llo wing command:
javac -classpath
.;
matlabroot\java\jar\toolbox\javabuilder.jar;
.\distrib\spectralanalysis.jar powerspect.java
c. On UNIX, execute the following command:
javac -classpath
.:
matlabroot/java/jar/toolbox/javabuilder.jar:
./distrib/spectralanalysis.jar powerspect.java
Note For matl abroot substitute the MATLAB root directory on your
system. Type
matlabroot to see this directory name.
8 Run the application
• On Windows, execute the
powerspect class file as follows:
java -classpath
5-13