Interactive introduction
to multiway analysis in MATLAB
Next Chapter: Basic PARAFAC
modeling Previous Chapter: Contents
CHAPTER 1
HANDLING MULTIWAY ARRAYS IN MATLAB
Contents

Load data

Plot data

Manage data

Summary

Comments

Data used: claus.mat
contains
fluorescence excitation emission data from five samples containing tryptophan,
phenylalanine, and tyrosine.
Purpose: Learning about the Multiway Toolbox for MATLAB and
about how to view, arrange, and plot multiway data in MATLAB. 
1. Load data
Use load claus and find out what
the file contains (use whos).
2. Plot data
Use the plot functions to view data and learn about the relation between
the threeway structure of the data and the twoway structure in MATLAB.
Make drawings on a paper to help understanding the relation between the
twoway MATLAB matrix and the threeway array. If you are low on (computer)
memory go to step three initially. Do the following plots and understand
what
is shown in the plots! Make drawings where you show what is being plotted;
both in terms of the threeway array and in terms of the twoway matricized/unfolded
array.
Plotting Emission spectra
> subplot(2,1,1),plot(X(:,1:201)')
> subplot(2,1,2),plot(X(:,1:402)')
What's the difference between the two plots?
Plotting excitation spectra
> subplot(2,1,1),plot(X(:,1:201:61*201)')
> subplot(2,1,2),plot(X(:,30:201:61*201)')
What's on the plots. What's the difference between the two plots?.
Plotting landscapes
> clf
> plot(X(2,:))
> figure
> plot(reshape(X(2,:),201,61))
> figure
> plot(reshape(X(2,:),201,61)')
> figure
> mesh(reshape(X(2,:),201,61))
> figure
> mesh(reshape(X(2,:),201,61)')
All five plots show the same data. What's the difference?
3. Manage data
As an example of managing the data reduce the size of X for easier
computations. Use only every third wavelength in the excitation mode (mode
three) and every sixth wavelength in the emission mode (mode two). Use
nshape.
If you have very little memory reduce the data even more. Remember to adjust
the dimensionality vector DimX
accordingly.
Hint me
4. Summary
In this chapter it has been shown how to manipulate and plot the data .
The main problem in handling the data is that the multiway arrays are
held in twoway matrices. However, to make the toolbox compatible with
older versions of MATLAB this is necessary. Even though the difficulty
in handling the arrays is disturbing it is not a problem pertaining to
multiway analysis but to MATLAB.
5. Comments please
Please comment here if the above
exercises help in understanding the basics of multiway data, or give suggestions
to improvements
Next Chapter: Basic PARAFAC
modeling Previous Chapter: Contents
The Nway tutorial
Copyright © 1998
R. Bro