|
Due: Monday,
February 26 by 5:00 p.m. via eMail to Doug.Harper@wku.edu
In class we demonstrated a fully functional
example of a fairly sophisticated state machine located
at G:\plab\Physics 418\Harmonic Data Plotter.llb\Harmonic Data Plotter
Main.vi that had the following
functionality...
The user could read a harmonic (sinusoidal)
waveform from disk and could then manually adjust amplitude, offset,
frequency, and phase parameters in order to attempt to make a second
waveform fit the raw waveform as closely as possible.
You were shown how to add a new STATE to this
routine by adding a button that would allow the user to save the raw data to
a file on disk. This process required three main additions:
- adding a new value to the type definition
for the enumerated constant used to control the state,
- adding a new button to the front panel and
connecting this button to the "Which Button.vi" in the
appropriate way, and
- adding a new case for this STATE to the
case statement.
For your assignment, add one additional case
that will allow the user to generate a set of raw data. A subVI will
be required to make a popup dialog box (see VI Properties on the Front Panel
icon) that will wait for the user to enter an offset, amplitude, frequency,
and phase along with a standard deviation for an additional amount of noise
on the waveform signal. Also, the sampling frequency and number of
samples must be specified. The "Create Waveform DataFile.vi"
file in the library distributed with this program will serve as a good
starting point for this subVI. You will need to modify it so that it
will function as a dialog box and will return the user specified
waveform. Add a new "Generate Data" button to the main
program and create a new case that will call your new subVI when this button
is pressed. Later in the semester you
will add an additional case that will perform a non-linear least squares fit
to the raw data using your fit parameters as initial guesses for the best
fit.
|