List of Matlab M-Files Used in ECE/CS/ME 539
Last Modification: Fall Semester 2018
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 email@example.com.
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.
- bvv.m -- Bias versus variance trade-offs
demonstration (use utility routines
randomize.m). Updated: 1/27/2016.
- lamexample.m -- Example of linear
- ghademo.m -- Principal component
analysis using generalized Hebbian learning. (use ghafun.m)
- learner.m -- demonstration of
error correcting learning (LMS) (use utility
- 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
- bpconfig.m -- Initial
configurations of a MLP (updated 10/9/2018)
- 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)
- rsample.m -- random sample K out
of Kr rows from matrix x.
- actfun.m, actfunp.m
-- Compute activation function and their derivatives (updated 10/9/2018).
- 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
- ae1.m -- AutoEncoder example using Neural Network Toolbox.
Support Vector Machines
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.
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 Relation Composition Demonstration
Fuzzy Logic Control Example: Dog Chases Cat
Randsom Search Algorithm demonstration: Travelling Salesperson
- 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
- 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
- rshift.m -- rotating shift of a
- 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
- datasepf.m -- generate two
classes of data samples within unit square that are
- 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.
- 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.