EE421 Matlab
Functions & Scripts
This page introduces and presents links to Matlab
functions and scripts that are useful for this course. By clicking the link
below a window will appear with the code for the mfiles.
You can save this as a simple text file with the same function name (extension
is always .m) directly with your web browser, or you can copy and paste into a
text editor and save it as a text file. You can execute this function or script
in Matlab provided the file is in your working directory or Matlab path.
Scripts
tutor.m
is a tutorial script that introduces the basic Matlab syntax, functions,
and operation, written by Kyle Dippery
rndroots.m
is a script that plots the zero-input response for a 10-th order system,
whose characteristic equation has real and distinct roots. Ten different
responses are plotted. The coefficients and time constants are chosen randomly
for each plot.
rnrroots.m
is a script that plots the zero-input response for a 10-th order system,
whose characteristic equation has real and repeated roots. Ten different
responses are plotted. The coefficients and time constant are chosen randomly
for each plot.
ccroots.m
is a script that plots the zero-input response for a 10-th order system,
whose characteristic equation has complex conjugate roots. Ten different
responses are plotted. The coefficients and time constants are chosen randomly
for each plot.
zinres.m
is a script that solves for the zero-input response based in the
characteristic equation and a set of initial conditions. This example has both
real and complex modes, but no repeated modes.
clipdis.m
is a script that harmonically constructs a clipped sine wave. You can
change the number of harmonic components in script file and observed the
resulting plot. The coefficients are plotted out and the total harmonic
distortion is also given.
puldis2.m is a script that
passes modulated squared pulses through a second order band-pass channel. The
output pulses are plotted along with the originals so the nature of the
distortion can be observed.
signoise.m
is a script that generates white Gaussian noise and adds it to a sinusoid.
SNRs of 2 and 1/4 are used. For both cases the signal plus noise spectrum is
plotted along with the histogram of the noise and the time-domain signals.
tondet.m
is a script that performs a Monte Carlo simulation to determine the
probability of detection of a tone in white Gaussian Noise with a -3dB SNR.
hwhp.m is a script that
computes and plots the output of a high-pass filter when the input is a
half-rectified sine wave. Two cases are shown when the cut-off frequency is
.5*(fundamental frequency) and when the cut-off frequency is 4*(fundamental
frequency). A plot of the high-pass transfer function and input spectra are
also given.
Functions
sinc1.m The sinc function
sinc2.m The sinc function
squared
rectw.m
The rectangular pulse function
triw.m The
triangular pulse function
unit.m The
unit step function