List of Matlab M-Files Used in ECE/CS/ME 539
Last Modification: Spring Semester 2016
These Matlab M-Files are written by Yu Hen Hu, and have been
tested on Matlab V.7. You are welcomed to use them for education
and research purposese. For commercial applications (including
for-profit education services), please contact Prof. Hu at hu@engr.wisc.edu .
For UW-Madison students enrolled in ECE/CS/ME 539, you may download the latest Matlab program from the Campus Software Library
If you spot mistakes in these routines, I will be happy to hear from
you to correct them. However, I am unable to provide free consultation
to solve your problem on hand. Nor will I help solving your homework
problem unless you are taking my class during the present semester.
If you are not familiar with Matlab, here are some
useful pointers
to learn it by yourself.
Learning
- bvv.m -- Bias versus variance trade-offs
demonstration (use utility routines
randomize.m). Updated: 1/27/2016.
- lamexample.m -- Example of linear
associative memory
- ghademo.m -- Principal component
analysis using generalized Hebbian learning. (use ghafun.m)
- learner.m -- demonstration of
error correcting learning (LMS) (use utility
routines randomize.m)
- lmsdemo.m -- demonstration of LMS
algorithm LMS learning, updated: 2/1/2016
- pcademo.m -- demonstrating how to represent
high dimensional data in lower dimension using PCA. 2/2/2016
- mypca.m -- compute the principle components
given a data matrix. 2/2/2016
- perceptron.m -- perceptron
learning algorithm (use utility
routines sline.m, datasepf.m)
Back-propagation Multi-Layer Perceptron
- bp.m -- MLP backpropagation driver
program for classification tasks. (use utility
routines scale.m, and randomize.m.) Other mfiles
needed:
- bpconfig.m -- Initial
configurations of a MLP
- cvgtest.m -- Convergence test
routine (updated 10/16/01).
- bpdisplay.m -- Display
intermediate and final result of BP training
- bptest.m, bptestap.m
-- Test classification (bptest.m) and approximation (bptestap.m)
results
- rsample.m -- random sample K out
of Kr rows from matrix x.
- actfun.m, actfunp.m
-- Compute activation function and their derivatives.
- partunef.m -- partition the
training data samples x into a training set and a tuning
set according to a user specified percentage ratio
- fsplit.m -- Random partition a
matrix x row-wise according to ratio:1
- mlpdemo1.m -- demonstration of feedforward
MLP's output as function of its two input
- mlp2.m -- a specialized 2-layer feedforward
MLP network, called by mlpdemo1.m
Pattern Classification
Support Vector Machines
Clustering
If you run clusterdemo.m and found error message, it is likely that
some of the routines call dist.m which conflicts with the built-in m-file
dist.m distributed by Mathwork, Inc. The patch is to change dist to mydist and
download mydist.m from the utility section. These programs have been updated on
Nov. 2008 and should not give that error any more.
Radial Basis Network
Time Series Analysis
- mademo.m -- Time series prediction
demonstration program using the moving average (MA) model.
Call mafun.m, and utility routines autocorr.m
- ardemo.m -- Time series prediction
demonstration program using the auto-regressive (AR)
model. Call utility routines
autocorr.m and tsgenf.m
Fuzzy Logic
Fuzzy Relation Composition Demonstration
Fuzzy Logic Control Example: Dog Chases Cat
Randsom Search Algorithm demonstration: Travelling Salesperson
Problem
- random_search.m -- demonstration of
various solutions of TSA problem using randsom search methods,
including exhaustive search (for 8 or fewer cities), genetic algorithm
(using tsa_ga.m), random-search, heurstic greedy search, simulated annealing
algorithm
- tsp_ga.m -- Joseph Kirk's implementation of TSP solver
using genetic algorithm. Can be found at Matlab central.
- permugen.m -- generate all
permutations of tours
- nbgen.m -- generate all
permutations within a neighborhood of a specified
distance
- rshift.m -- rotating shift of a
vector
Utility Routines
- dbmoon.m -- generate double moon data set shown
in Figure 1.8 of Haykin neural network and learning machines, 3rd edition
- shadeplot.m -- illustrating how to
plot a shaded area in a 2D region
- randomize.m -- randomize the
row order of a matrix
- sline.m -- given a line function,
compute the intersection of the line with the perimeter
of a 2D box so that the line can be plotted. called by
perceptron.m.
- datasepf.m -- generate two
classes of data samples within unit square that are
linearly separable.
- scale.m -- called by bp.m to
linearly scale the input to a specified range.
- datagen.m -- 2D Gaussian Mixture
data generation. May generate rotated, elliptic Gaussian
clusteres. Labels can also be assigned. (Updated: 11/23/2005)datagen1.m -- variant of datagen.m.
- cdgen.m -- generate two clusters of data for
evaluating clustering algorithms
- fungen.m -- generate 1 input, 1
output functions of (1) sinusoids; (2) piecewise linear
functions; or (3) polynomials. fungenf.m
-- callable function implementation of fungen.m
- polyfit1d.m -- fitting 1D data
to a polynomial
- mydist.m -- calculate distance between
two sets of points in L2, L1 and L_infinity norm
- autocorr.m -- calculate sample
auto-correlation or autocovariance lags using rectangular
window or triangular window.
- tsgenf.m -- generate time series
and corresponding training and testing matrices. AR
model, ligistic time series and rounding time series.
Data Sets
- xor -- XOR problem data file, M
= 2, N = 1
- and -- AND problem data file, M
= 2, N = 2
- parity4 -- 4-bit parity
problem data file, M = 4, N = 1
- parity7 training data, and
parity7 testing data -- 7-bit
parity problem data file M = 7, N = 1
- IRIS training data IRIS testing data IRIS
classification problem data file, M = 4, N = 3.