lecture06

advertisement
LabView Lecture #6 Outline
W. Rose
1. Continuing EKGviewer.vi example
2. Use the peak (or valley) locations (which we already found, with Waveform Peak
Detection.vi) to chop initial waveform into segments. Use Get Waveform Subset.vi inside a
for loop to cut up the waveform and generate an array of waveform segments.
3. Give each waveform segment the same start time as the first one, by using
Align Waveform Timestamps.vi. Plot the segments. They should all start at the same time,
but their durations will probably differ.
4. Resample each segment at 100 equally spaced points. This is done so that comparable
waveform segments of slightly different durations can be averaged with one another. Use
Interpolate 1D.vi to do the resampling. Key steps include:
A. Feed the array of waveforms into a for loop with automatic indexing, so that only one
segment enters the for loop at a time;
B. Extract the Y values from the waveform segment
C. Use makeramp.vi to make an array [0,1,2,…,Ni-1], where Ni=number of points in
waveform i. These values comprise array X and are the “time” values associated with the
un-resampled waveform segment.
D. Use makeramp.vi to make an array [0,N/100,2N/100,…,99N/100]. The values comprise
the array xi and are the “time” values to which we will interpolate.
E. Use 1D Interpolate.vi , with arrays Y and X and xi as inputs, to resample the segment at
100 equally spaced points.
5. Plot the resampled (or “stretched”) waveform segments. They should all be 100 points long.
6. Find the mean and standard deviation at each of the 100 time points, as follows:
A. Make a 2D array of the resampled waveforms’ y values.
B. Transpose the array and then feed it into a for loop with automatic indexing. If we did
not transpose, it would go in to the for loop one whole segment at a time, which would
defeat our purpose. We want the first point from all the segments during the first pass
through the loop, then the second points from all the segments, then the third points from
all the segments, and so on. Transposing makes the data go into the for loop the way we
want.
C. Find the mean and standard deviation inside the for loop, and feed those results out
through the for loop with an indexed tunnel, so that after the final loop pass, there are 100
mean values and 100 standard deviations.
7. Plot mean, mean+2*SD, and mean-2*SD on one graph.
8. Front panel now has four waveform graphs: too many to see at once. Put a tab control on
front panel and put each graph on its own tab.
9. Introduce flat sequence structure: EKGviewer_seq.vi.
10. Introduce stacked sequence structure: EKGviewer_stackseq.vi. The stacked sequence
structure allows us to make our block diagram take up less space by using multiple “pages”
instead of one huge page.
See assignment 2: Knee angle analysis
Download