Peaks and valleys detection of a zig-zag shape waveform

Hi,
I have 2 waveforms coming in and I would like to detect the peaks and valleys(with the location, or ) and write them to a spreadsheet file. 
In a pattern like this
peak #1(waveform 1)            peak #1(waveform 2)                  Location of peak#1(waveform 1)              Location of peak #1(waveform 2)   
valley #1(waveform 1)           valley #1(waveform 2)                Location of valley#1(waveform 1)             Locationo of valley#1(waveform 2)
peak #2(waveform 1)            peak #2(waveform 2)                  Location of peak#2(waveform 1)              Location of peak #2(waveform 2)
valley #2(waveform 1)           valley#2(waveform 2)                  Location of valley#2(waveform 1)            Location of valley #2(waveform 2)
  The waveforms come in with varing heights, kind of like a wiggling zig zag shape.  Sometimes the peaks/valleys are very smooth and kind of hard to differentiate from the others. 
Thanks.

If you search the forums for peak detect, you will find a number of hits.  Also, here is a recent thread discussin peak detection without setting a pulse width.
Basically, you want to use the peak detection.vi located in Signal Processing > Signal Operation.  That will find your peaks and valleys.
In order to put all of this into Excel/Spreadsheet (do you have / want to use the Excel Toolkit or just the Write to Spreadsheet.vi?), you will need to  feed all of your points into a build array and a shift register and then when you are done aquiring data, feed that into the Write to spreadsheet.vi or to a vi for excel.
The formating will depend on how you feed the data into your array, ie wave 1, location 1 or wave 1 , wave 2, etc
Kenny
Kenny

Similar Messages

  • How can I get the peak and valley of a MZI signal

    I am using MZI signal which is similar to sine wave with frequency of 10MHz to calibrate an interference signal. I want to get the peak and valley of the MZI signal and get the corresponding value of interference signal at the same location. The problem is that the MZI signal aquired by DAQ is not smooth, Please see attached filter.PNG, the top left is the MZI, top right is the MZI Zoomed in, you can see that there may be two values that are approximately same to each other. I used a peak detector to detect both the peak and valley and a build array to concatenate them. I am worried that the peak detector may find two peaks or two valleys in a fringe. So I used the filter function in express to bandpass the MZI signal (cutoff frequency is 8MHZ~12MHZ) to smooth the signal, the result zoomed in is  the bottom graph in filter.PNG. But I found that it did not solve the problem but cause phase shift. Is there somebody can give some help?
    Attachments:
    filter.PNG ‏143 KB
    peak detector.PNG ‏69 KB

    I don't know anything about MZI signals, but I do know sine waves.  If this is a sine wave, it is relatively easy to measure its amplitude as long as you know the frequency.  Since you say it is 10 MHz, you appear to know the frequency.  You can use Fourier analysis to determine the magnitude and phase of your signal, as long is it is a steady signal that doesn't change frequency or amplitude.
    Generate a sine and cosine wave using the same frequency.  Divide each wave by the sum of its points.  Multiply each one by your incoming signal and sum all the values, one sum for sine and one sum for cosine.  The sums should be the coefficients of the sine and cosine components of your unknown signal.  The ratio tells you the phase of the signal.  If you multiply the sine and cosine waves by their coefficients and add them together, you should be very close to your incoming signal.  The amplitude of your signal is equal to square root of A*A+B*B, where A and B are your coefficients.
    I may be off by a constant factor here somewhere (probably pi), since I didn't write down the equations and verify them.  These equations are the basis of the Fourier series, though, so they would be fairly easy to find.
    Another option would be resampling.  If you upsampled the data and increased the data resolution by a factor of 10 or so and filtered the results using an FIR filter, you would have a much cleaner signal with a lot more detail.  You wouldn't have any problem locating and measuring peaks and valleys.  This would probably work better with your data, since it looks like it doesn't have a constant magnitude.  To upsample the data, just add 9 zeroes between each data point.  Create a lowpass FIR filter that is based on 10 times the original sampling frequency and has an amplitude of 10.  The cutoff frequency should be half the original sampling rate.  Filter your new data and you should get the same waveform with 10 times the resolution.
    Bruce
    Message Edited by Bruce Ammons on 10-02-2008 09:10 PM
    Bruce Ammons
    Ammons Engineering

  • Locating peaks and valleys on a map using java.

    This is the assignment for my excerice,if someone knows the code,please give it to me.
    I'm still beginner in java,and i have to submit that project by monday.
    Topographical maps are easily represented with two-dimensional
    arrays of integer or real valued
    heights. However, the bird's eye view they provide is sometimes
    difficult to appreciate after a day of
    lugging a 70-pound backpack.
    Consider a two-dimensional array variable storing real numbers and
    representing heights of a
    topographical map.
    Write a program that locates peaks. We define a peak as any point that
    is higher than its eight
    neighbors.
    Write a program that locates valleys. A valley is any series of three
    points along a row or column that
    are lower than their twelve neighbors. (Can you deal with longer
    valleys as well?)
    1. Define a two-dimensional array type for holding real numbers and
    having a size of maxrow times
    maxcol;
    2. Declare a Boolean method that tests if a point of this map
    represents a peak;
    3. From the main program locate all peaks and output their positions
    and heights;
    The header should be like this:
    peak number Row position Column position weight
    and for valleys it will the same heading
    valley number Row position Column position

    This is the assignment for my excerice,if someone
    knows the code,please give it to me.
    I'm still beginner in java,and i have to submit that
    project by monday.Tthis really isn't a beginners problem. Or if it's a beginners problem it's a beginners problem at a school with high standards. Above all it's clever. The problem is formulated in a way that you're unlikely to find code on the internet that exactly fits the bill and can be directly copied.
    So if you stay off the booze tonight and skip church tomorrow you have a whole day on your hands. Use it well. The problem is clearly formulated and should pose no problem for a rasonably smart student -:)

  • Gradient on a zig-zag shape

    Hello Illustrator experts out there!
    I'm stuck trying to apply a gradient to a zig-zag object that I've created on Illustrator. I want every peak to be black and the gradient should be kind of rounded (but not radial). The center of the shape should show the transition betwen the darker color and the lighter one.
    Please see image attached:
    How do I achieve this using the gradient tool?
    Many thanks in advance and I look forward to your replies!

    I hope this is what you're talking about. In the Gradient panel, first change the direction of the gradient. Then add in 3 other markers to your gradient bar and position them accordingly. (You can type in the exact position where it says Location. If you double click on a marker, you will then see a K (levels of black). Type in the numbers shown in my preview for each marker. I hope this helps.

  • Counting Peaks and Valleys of a sine cycle with noise

    I am having a problem with the peak detection VI. I have attached a typical signal that I am getting: an offset of 4 V and an amplitude of 1 V. I have put these values into the simulated sine with noise VI, as you can see. What I want this peak detector to do is give me an array of all the valleys in order, i.e. 2,97 2,90 3,00 2,90 2,88. What numbers should I give to the threshold and width in order to get an array with these values in that order. Also what numbers should I enter to show all the peaks in order i.e 5,25 4,90 5,10 5,09 4,94. Thanks.
    Attachments:
    Front_Panel_Screenshot.gif ‏19 KB
    Block_Diagram_Screenshot.gif ‏10 KB

    You could run your data array into a for loop. Take 'x' datapoints from the beginning of the array. Then use the array max/min function for the section of the array. On the next run in the for loop, take the next section of the data array and use the array max/min function.

  • How to make it look like the camera is following a zig zagging line

    I have an animated video where a person clicks a button and an arrow appears coming out of the right side of the computer. I would like to make it look like the camera follows the arrow as it zooms along a zig zag path and eventually ends at another computer.  Does anyone know of any good tutorials for this? 
    Thanks,
    Paul

    This is just a matter of keyframes for camera position and point of interest.You are probably not going to find a tutorial that exactly matches your project. Try this:
    Open up 2 views, one active camera, one top view.
    Set a position keyframe for the camera where you want the movement to start.
    Drag the point of interest to point at your subject (animated arrow)
    Using the top view and setting the CTI (current time indicator) to the end point of the camera move, move the camera's point of interest  to the same position as the animated arrow
    Still in the top view, move the camera to it's final position
    Using the pen tool (keyboard shortcut g) add points to the camera position path and drag them into a zig zag shape using the top view
    Selecting the Point of interest in the timeline, adjust the position of the point of interest to follow the arrow as it animates across the screen by moving the CTI and setting new positions.
    Another thing you could do would be just to use a lookAt expression for point of interest. This would keep the camera pointed at the arrow.
    Hope this helps. Animating a camera is one of the most basic skills an AE artist should have. It takes a bit of practice but it's not hard.

  • Peak/valley detection problem

    Hi,
    How can i detect the maximum peak to valley on the graph attached.  It is not the difference between the maximum and minimum all the whole data set that i require, I want to know the maximum value of the higher frequency peaks and valleys ignoring the small 'blips' within the data.
    The X-axis is controlled by time and the number of samples between each peak varies between data sets.  I have considered using a moving average to smooth the data but cannot do this due variation of samples between peaks.
    Using the peak/valley detection VI would work great but due to the small 'blips' in the data set a true maximum value cannot be found.
    Can anyone help?
    Tom
    Attachments:
    graph.JPG ‏20 KB

    Hi Tom,
    I have been looking into your issue in an attempt to find you a solution. My initial thoughts are that you should apply some form of smoothing to the waveform before subjecting it to the the Peak Detector sub VI to detect the amplitude of the peaks and the troughs. These amplitudes could then be subtracted form each other thereby arriving at the values you are looking for. Can I confirm that this would solve your problem.
    I have been looking into a methodology for smoothing your waveform and I found the following example which uses a moving average technique, which I think could be useful. Take a look and let me know what you think.
    Best Regards,
    Christian Hartshorne
    Applications Engineer
    National Instruments UK  
    Attachments:
    Moving_Average-1.vi ‏15 KB

  • Trying to charge ipod and only thing that will show up is a plug with an arrow pointing to a zig zag line

    when i went to charge my ipod it wont charge, so i pluged it into my computer and still the same thing pops up its a plug then an arrow pointing to a zig zag line..

    Not Charge
    - See:       
    iPod touch: Hardware troubleshooting
    - Try another cable
    - Try another charging source
    - Inspect the dock connector for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genus Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • Aspire 6920 crashes after booting correctly - screeen zig zags and freezes - any ideas to help plse?

    My aspire 6920 crashes after booting correctly - screen zig zags and freezes - any ideas to help plse? This does not happen in safemode which I am working in now - I have seen a list of dowloadable drivers on the acer site but not at all sure if I should download any. If laptop is really on its way out I will have to let it go - but I would appreciate any advice to extent its life,  Thanks

    Many thanks - relieved that it can be done but I am very unconfident that I can do this - is the display driver the display adapter in Vista? Not at all sure how to install new driver from Acer site - Could I use 'Drivers for free' download - I tried to set up an account with them after seeing their free download on CINET but not able to from 'safe mode' and laptop crashes when I try to do anything ( after about a minute ) in ordinary mode.  Any further advice welcome, thanks

  • Macbook Pro and Zig Zag Lines

    Hello....I am wondering if anyone can shine some light on my problem. I have a Macbook Pro (15", Intel Core 2 Duo, 2.33 GHz) that is about 4 years old.
    About 2 years back the MBP tossed up zig zag lines across the screen and refused to work. I put the MBP away for a year and 1/2 and on a whim decided to hook it up to my mini to see if I could recover my data in target mode via firewire.....I could, and tossed my stuff on to my ex-hd. I then tried running Disk Utility on the MBP via the Mini. Once finished repairing the disc I restarted the MBP and it worked! The MBP has worked since early Spring and craps out every other week or so...back to the zig zag lines, etc. I repeat the above mentioned first aid and it then works again....(I'm unable to use the MBP's Dick Utility because it quits before it can open???)
    I was told it could be the logic board...and the MBP does run hot...I just find it interesting that I can hook it to the Mini for some CPR and it works again!
    So there you have it.
    Any takers?
    Thanx!

    Hi s,
    If it's one of the machines potentially affected by the NVIDIA issue, I'd certainly have it tested:
    http://support.apple.com/kb/TS2377

  • Multiple Valley Detection Query

    Hello There,
    I am having trouble detecting multiple valleys within a bell curve type shape (see pic). The valleys are moving horizontally and I need to detect each of their positions in real time. The other issue is that the dips increase and decrease in magnitude thus making it difficult to use the dip detect function as it keeps jumping from one to the other.
    any help would be greatly appreciated,
    thanks.
    Attachments:
    multiple valley detect.jpg ‏51 KB

    Hi TriboBoy,
    Have you tried setting the threshold level above your data so that the algorithm used within the Peak Detection and Display VI considers all of the valleys occurring below it?
    Below is a screen shot of the resulting graph using the Peak Detection and Display VI example in Example Finder:
    The blue threshold line corresponds to the valley data points being considered and has been set to a value higher than any expected data points.  
    It is also worth noting that the width used should be as low as possible (limited to a value of 3) so that the maximum number of data points are considered.  
    Let me know if this helps you at all.
    Regards
    Marshall B
    Applications Engineer
    National Instruments UK & Ireland

  • What do the zig zag lines mean on a clip in Premiere pro?

    What do the zig zag lines mean on a clip in Premiere pro? And how do I fix it as I can't see a video image for that clip?

    More information needed for someone to help... please click below and provide the requested information
    -PPro Information FAQ http://forums.adobe.com/message/4200840
    What are you editing?
    Codec & Format information, with 2 links inside for you to read http://forums.adobe.com/thread/1270588
    Report back with the codec details of your file, use the programs below... A screen shot works well to SHOW people what you are doing
    http://forums.adobe.com/thread/592070?tstart=30 for screen shot instructions
    Free programs to get file information for PC/Mac http://mediaarea.net/en/MediaInfo/Download
    What is your exact brand/model graphics adapter (ATI or nVidia or ???)
    What is your exact graphics adapter driver version?
    Have you gone to the vendor web site to check for a newer driver?
    For Windows, do NOT rely on Windows Update to have current driver information
    -you need to go direct to the vendor web site and check updates for yourself
    ATI Driver Autodetect http://support.amd.com/en-us/download/auto-detect-tool
    nVidia Driver Downloads http://www.nvidia.com/Download/index.aspx?lang=en-us
    Review the NEW ITEMS process link in reply page #5 in The PPro/Encore tutorial list http://forums.adobe.com/message/2276578 to be sure your sequence and video match

  • Zig Zag Effect - How is a segment calculated on a circle?

    I have a perfect circle, to which I have applied the Zig Zag effect. I have specified 2 ridges per segment. If I am correct in assuming that a "ridge" is the high, outer part, I end up with 6 ridges on my circle. If I specify 10 redges per segment, I get 22.
    So what does Illustrator consider a segment on a circle, and other than trial and error, how can I get a desired number of ridges?

    Ridges Per Segment means Points Per Segment. Expand Appearance and then count the points.
    Then try it again, but set the Size slider to zero.
    In both cases, you'll have 12 points; the original four and eight added (two per segment).
    You have six "star points" because there is an anchorPoint at each trough and each crest; 6 pairs of trough and crest makes six waves.
    JET

  • Create a zig zag effect in array

    I have a one dimensional array that holds the pixels values for the image. I currently go through it like so:
    for (int y = 0; y < height-1; y++) {
         offset =y*width;
         for (int x=0; x < width-1; x++) {
              pos = offset + x;
              oldPixel = pixels[pos];
    ...What I now want to do is instead of going in a constant left to right motion is to go in a zig zag motion. This means I want to go left to right on the first line then the second line is from right to left and then back to left to right again for the next line.
    Any ideas on what would be the best way to do this?
    Thanks.

    4fingers wrote:
    Any ideas on what would be the best way to do this?Are you sure about the limits? It usually looks like this,
    for (int y=0; y<height; y++) {
    The above will loop height times.
    Anyway you can introduce a boolean variable called say leftToRight which is controlling the scanning direction,
    boolean leftToRight = true;
    for (int y = 0; y < height; y++) {
       offset =y*width;
       if (leftToRight) { // from left to right
          for (int x=0; x < width; x++) {
             pos = offset + x;
             oldPixel = pixels[pos];
       } else { // from right to left
          for (int x=width-1; x >= 0; x--) {
             pos = offset + x;
             oldPixel = pixels[pos];
       leftToRight = !leftToRight; // change direction

  • Zig Zag Filter Issues

    I am  using Illustrator CS4 on a Macbook Pro with Mountain Lion...on to the issue.
    The first time I used the zig zag filter today I got exactly the effect I wanted:
    Then when edited it to to take it from 15 ridges to 14, this is what happened:
    I didn't change anything but the number of ridges per segement. 
    Subsequently I tried opening a new document (as well as restarting Illustrator) and creating a totally new line and applying the zig zag filter and got the same weird result again.  I compared my appearance panel settings and everything is the same except the appearance of the thumbnail.  I know this must be something easy that I'm overlooking but for the life of me I can't figure out what it is!

    Your path has a fill. You went from an odd number of points making the start and end at the top of the zig zag, to an evwn number of points making the start at the top and the end at the bottom. Illustrator is simply auto-filling an open path.

Maybe you are looking for