Interactive introduction to multi-way analysis in MATLAB
Next Chapter: Basic PARAFAC modeling Previous Chapter: Contents 




  1. Load data
  2. Plot data
  3. Manage data
  4. Summary
Data used: claus.mat contains fluorescence excitation emission data from five samples containing tryptophan, phenylalanine, and tyrosine. 

Purpose: Learning about the Multi-way Toolbox for MATLAB and about how to view, arrange, and plot multi-way 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 three-way structure of the data and the two-way structure in MATLAB. Make drawings on a paper to help understanding the relation between the two-way MATLAB matrix and the three-way 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 three-way array and in terms of the two-way 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 multi-way arrays are held in two-way 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 multi-way analysis but to MATLAB.

5. Comments please

Please comment here if the above exercises help in understanding the basics of multi-way data, or give suggestions to improvements

Next Chapter: Basic PARAFAC modeling Previous Chapter: Contents

The N-way tutorial
Copyright © 1998
R. Bro