Calculate envelope curve x spacing

Hi,
I have a sinusoidal voltage signal where the amplitude changes with time.  I want to determine the amplitude's dependence on another variable, so I need to separate out the oscillatory information.  I tried using the calculate envelope curve function, but the x channel spacing is not equidistant - you can't combine the x and y channels to make a waveform channel - so I don't know how to compare these channels with my other data (i.e. using regression). 
It seems that the envelope function goes through the data set and selects out all of the extreme points, divides these between upper and lower bounds, and puts these data points in the new channels.  Is there some function that would allow me to set up an x channel with equally spaced points, and interpolate the corresponding values for the envelope?
I tried using a curve fit to approximate the amplitude data, but it doesn't retain enough of the features.
Thanks, Myra
Solved!
Go to Solution.

Hi Myra,
It sounds like the key issue you're facing is that you have one curve with non-equadistant X values and a second curve with equadistant values, and you want to compare the Y values of those 2 curves at exactly the same X values.  This is what the "Linear Mapping" function in the ANALYSIS Curve Fitting palette does.  Just provide the X and Y channels of the non-equadistant curve in the first two dialog fields and the X channel of the equadistant curve in the third field.  This will create a linearly interpolated version of your non-equadistant curve that has exactly the (equadistant) X values as your other curve.
If your equadistant X value curve is a waveform, then you'll need to first use the "Numeric Channels <=> Waveform Channels" function from the ANALYSIS Channel Functions palette, in oder to create that X channel you'll need in the third dialog field as described above.
Ask if you have further questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

Similar Messages

  • Generic file load

    Option Explicit
    Dim Row, FilePath, Folder
    Const ExcelFileName = "curve linear final limits  ECE-AIS.xls"
    Const ExcelSheetIdx = 1
    Const StpFileName = "curve linear final limits  ECE-AIS.stp"
    Call Data.Root.Clear
    'get FilePath from dialog
    Call FileNameGet("ANY", "FileRead", DataDrvUser, "DAT files (*.dat),*.dat", "", 0, "Select File to Process...")
    If DlgState = "IDCancel" Then Call AutoQuit
    FilePath = FileDlgName
    'Load dat file
    FilePath = AutoActPath & "C100227-6.DAT"
    Folder = NameSplit(FilePath, "P")
    Call DataFileLoad(FilePath)
    'import limit channels from Excel file
    Call ExcelImport(Folder & ExcelFileName, ExcelSheetIdx, 0, Folder & StpFileName)
    'load the VIEW layout to show the data and (eventually) the envelope curves
    Call View.LoadLayout(AutoActPath & "TUV.TDV")
    'Search for the first Row where the value in channel 2 has exceeded 1.0, add 0s to shift the envelope curves
    Row = Find("Ch(2) > 1.0")
    IF Row > 0 THEN
      Call ChnAreaInsert0(3, 1, Row+1)
      Call ChnAreaInsert0(4, 1, Row+1)
    END IF
    'Come to report panel, refresh it to see the 3 curves
    Call PicLoad(AutoActPath & "TUV.TDR")
    Call PicUpdate(0)
    Hi all, 
    In the above script, what ever the dat file i load, the same C100227-6.DAT's is appearing in the graph. I tried doing it for any other file. But getting some errors and cant trace it out.
    Can any one tell me how can i make this script to plot graph for any other file other than C100227-6.DAT mentioned in the script.
    Also please let me know how do i learn loading generic file, generic channel referenceing, All generic things, etc etc. Instead of mentioning a specific file in a script . Any material to learn this available please guide me. 
    Thanks in advance.
    Rash
    Solved!
    Go to Solution.
    Attachments:
    New Folder.zip ‏29 KB

    Hi Rash,
    Sure, just remove this line from the script:
    FilePath = AutoActPath & "C100227-6.DAT"
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Audio Editing Issues

    Hi
    Has anyone worked out something for these situations?
    1: I have source footage with 2 tracks ... dual mono... wireless mic 1 and wireless mic 2.  I edit the clip into a Project (set up as Stereo out) and need to balance the two audio clips. I can select the clip ... set it to Dual Mono in the inspector... and Pan Left/Right.  But to adjust the levels of the individual channels it seems I have to right click on the clip in time line  and select "Open In TimeLine". Now I see the 2 channels. The Format settings need to re-set to dual Mono and pan settings to Stereo Left / Right .... now I can Pan the tracks and set a Level Envelope curve for each on the timeline... but can't hear the rest of the Program Mix!!!
    Is there a way to just get all of  clips's audio tracks to show in the Main Timeline. Expand doesn't seem to do it? Seems soooo basic.
    2: If Im editing video and audio into the timeline how do I choose which audio tracks to edit into the program. I see how to select Audio / Video or both .... but if I just want one track?  Do I have to keep switching audio tracks on and off in the Source clip via the inspector?
    Thanks
    Lee

    Unless you can balance the two channels in the separate timeline and then mix the combined tracks in the main timeline you don't have a good solution. You can break the clips apart in the timeline, but be warned there is no way to put them back together again short of putting each clip into a compound clip and having to open and close it to work with it. It also creates other editorial limitations.
    2.  Afraid so. You can also switch tracks off and on for ttimeline clips in the inspector.
    Audio is very limited in FCPX.

  • Issues Working With Audio

    Hi
    Has anyone worked out something for these situations?
    1: I have source footage with 2 tracks ... dual mono... wireless mic 1 and wireless mic 2.  I edit the clip into a Project (set up as Stereo out) and need to balance the two audio clips. I can select the clip ... set it to Dual Mono in the inspector... and Pan Left/Right.  But to adjust the levels of the individual channels it seems I have to right click on the clip in time line  and select "Open In TimeLine". Now I see the 2 channels. The Format settings need to re-set to dual Mono and pan settings to Stereo Left / Right .... now I can Pan the tracks and set a Level Envelope curve for each on the timeline... but can't hear the rest of the Program Mix!!!
    Is there a way to just get all of  clips's audio tracks to show in the Main Timeline. Expand doesn't seem to do it? Seems soooo basic.
    2: If Im editing video and audio into the timeline how do I choose which audio tracks to edit into the program. I see how to select Audio / Video or both .... but if I just want one track?  Do I have to keep switching audio tracks on and off in the Source clip via the inspector?
    Thanks
    Lee

    Sorry ... don't know how I posted here ... off to FCP X !

  • Digital Out Sample Clock Sources

    Hey guys,
    I am putting together an application <attached>.
    Currently I have the ai/sampleclock wired to its timing VI.  When I run this with highlighting on, it just goes to the read for the digital in task and waits there like it has not yet acquired enough samples.  Am I right in thinking that this should result in an array of integers 2000 elements long with 1's where the line is high and 0's where the line is low?
    When I swapped the clock source to being di/sampleclock I get something about my device not supporting it.
    This is my first adventure into digital in, anybody have a quick hint?
    Thanks,
    ~milq
    p.s. LV 8.2 - PCI 6289
    Attachments:
    Wobble Test.vi ‏63 KB

    First - how are you doing a difference of 2 quad encoders?  Are you taking the A channel from each of 2 different encoders running at the same nominal pulse rate?  I'm away from my LV PC and can't go back and look now.  I've done that kind of thing before, where you configure for up/down counting and you get a measure of relative lead and lag. 
    Second - all the stuff I did was at home while procrastinating and is fully untested.  Don't trust it to do what I said it should without testing.
    Third - does it make sense to save data continuously like I tried to do for you?  I've developed a rule of thumb that says, "when in doubt, store to file and defer the decision-making."  The reason I goofed with the # of samples acquired & displayed was that I pictured you updating a graph representing <something> through exactly 1 engine cycle.  Seemed like updating it a couple times a second would be enough. 
    Since this is your thread and you asked, here's the scoop on Audacity:  I actually grunted through that stuff several months back.  I probably did use the envelope tool, but I think I ended up applying it piecewise in several little pieces through the fade region.  I couldn't make the envelope curves apply just the right shape to keep the volume constant across the fade.
    It was interesting in a weird way.  I'd have thought going in that nothing could be easier to mix imperceptibly than noise.  It turned out that the clicks you get with no fade and the volume artifacts coming from linear fade make noise especially *difficult* to mix.
    At some stage I think I mixed in some pure noise and then applied some filtering to cut out high freq hiss.  I also added some low freq amplitude modulation and some low freq Left<-->Right panning.  In the order of <0.1 Hz, with the two effects at frequencies without common multiples.  Overall the effect isn't very noticeable (especially the panning on a boombox), but I think the slight variation works better than 100% solid repetition.  Anyway, they were effects sitting there in Audacity and I figured they'd be fun to goof with.
    Finally, a couple months after the first cd I found an old "Nature Sounds" tape of crashing waves on a beach.  So I mixed that in with the original cd to make a version 2.  The nightly scoreboard is now Fans - 2, Boomboxes - 2.  I'm getting there...
    -Kevin P.
    Edit: put back a sentence I accidentally deleted
    Message Edited by Kevin Price on 03-30-2007 03:16 PM

  • Anyone for Perl programming??

    hi, can you help me about the use of hash function to calculate this :
    @rawgrades = (1stgrade*0.25) + (2ndgrade*0.25) + (3rdgrade*0.25) + (4thgrade*0.3)
    for the following code?
    it reads the data normally into an array structure, but I tried to hash it, either it gave single value per key or another type of errors. How can I add this "hash" function to apply the above formula to the values per key?
    #perl code
    #!/usr/local/bin/perl -w
    use Fcntl ':flock';
    $file = "data.txt";
    open(INFILE, $file) or die "File Not Found";
    flock(INFILE, LOCK_EX);
    while (<INFILE>) {
    @grades = (split(/ /, $_));
    push @students, [@grades];
    %keys = @students;
    flock(INFILE, LOCK_UN);
    for($x = 0; $x <= 15; $x++){
    for($y = 0; $y <= 4; $y++){
    print $students[$x][$y], " " ;
    print "\n";
    close(INFILE);
    my data
    Frank 89 90 76 88
    Chris 70 95 90 100
    Raji 60 80 89 90
    Moe 90 90 67 56
    Pam 100 50 85 50
    Denis 50 10 78 34
    Sam 23 90 80 75
    Rick 100 67 89 88
    Sal 98 90 80 75
    Adam 90 90 67 56
    Jim 89 89 89 10
    Rich 99 67 89 67
    Dan 78 100 87 67
    Sally 39 80 90 98
    Hugh 78 85 100 100
    Alan 99 15 54 87
    thank you so much!

    Thanks for the comments and help, I thought the code tag would work only for java code, anyway now I`m putting the code between those tags:
    I wrote the code using subs, the 1st one did it ok , it read the file but the 2nd one my logic is a bit off, I guess..Since I`m new to this language, I`m trying to use analogies between other languages, anyway this is the logic:
    open file
    read file
    for each line
    store the name as a key, calculate the grade as the value of a hash
    formula:
    (1st grade * 20%) + (2nd grade * 25%) + (3rd Grade * 25%) + (4th Grade * 30%)
    print out to file
    sort keys in hash
    for each key
    calculate the curve
    formula:
    ( sqrt ( orig_grade ) * 10 ) - orig_grade, This should then be added to the grades, to get the new final grade.
    if name begins with 'S' subtract 2 from curve
    if name begins with 'R' and ends with 'k' add 3
    write out key, grade, and curve grade
    close files
    Example input file:
    Theadore 50 10 78 34
    Simon 23 90 80 75
    Alvin 90 90 67 56
    Example output file
    Alvin 74.05 86.05
    Simon 69.6 81.43
    Theadore 42.2 64.96
    The below code that I wrote is with my insructor`s comments, I think he`s mad at me.. I wish it was in Java
    #!/usr/local/bin/perl -w
    # Name:       curves.pl                          *
    # Authors:    edeita2*
    # Medium: Perl                                   *
    # Created: 3/5/04                                *
    # Purpose: To read the file containg the students*
    #          names and their grades.Calculate the  *
    #          curves for each student and treating  *
    #          some of them in different manner as   *
    #          far as calculation goes, those whose  *
    #          names match the given characters will *
    #          get the deserved treatment            *
    use strict;
    use Fcntl  ':flock';
    #Variables                                       *
    my $dataFile = "";
    my $rawgrade = "";
    #********************Main*************************
    if($#ARGV == 0) {
      $dataFile = fileReader($ARGV[0]);   #sub1
      $rawgrade = calcgrades($dataFile);  #sub2
      # You weren't passing '$rawgrade' down, you need it
      # presumably...
      printList($dataFile, $rawgrade);    #sub3 
    else {
      print "Usage: -- ./curves.pl filename\n";
    #*********************Subroutines*****************
    sub fileReader {
      my $dataFile = "";
      my ($file) = @_;
      open(INFILE, $file) or die "File Not Found";
      flock(INFILE, LOCK_EX);
      while (<INFILE>) {
        $dataFile = $dataFile . $_;
      flock(INFILE, LOCK_UN);
      close(INFILE);
      return $dataFile;
    sub calcgrades {
      # you are not actually accepting the value you are
      # passing down, you can't do anything with it
      # if it is not here...
      my $dataFile = "";
      my ($datafile) = @_;
      my @rawgrades;
      # I don't know why this is here...
      # my $dataFile = shift;
      my %students;
      for( split/\n/,$dataFile){
        my $s;
        ($s,@rawgrades) = split;
        $students{$s}=[@rawgrades];
      my @keys = keys(%students);
      foreach my $key ( sort @keys ){
        @rawgrades = @{$students{$key}};
        print "@rawgrades\n";
        my $rawgrade = $rawgrades[0]*0.2 + $rawgrades[1]*0.25 + $rawgrades[2]*0.25 +$rawgrades[3]*0.3;
        print "$key\t$rawgrade"\n\n";
      # you are returning $rawgrade, which in this case would be
      # the very last thing you calculate, I don't
      # think that is what you want to do?  If anything you should
      # be returning an array or something....
      return $rawgrade;
    sub printList {
       my($dataFile, $rawgrade) = @_;
       print"\n---------------------\n"; 
       print"     Student Data\n";
       print"\n----------------------\n"; 
       print "$dataFile\n\n";

  • How to get this wave profile

    How to get the wave profile of the attached vi.
    The waveform is made of oscillition of AC waveform. Only the wave profile is useful.
    May I know how to get it out.
    Message Edited by turbot on 03-14-2009 07:20 AM
    Attachments:
    wave.vi ‏1983 KB

    If I understand you correctly, you want the enveloping curve of the signal or the amplitudes of each period?
    Some ideas, you posted too little info on the signal:
    * chop the signal with a trigger close to zero, then just take the max for each chunk
    * Filter out the carrier signal, use a bandstop filter of the frequency
    * Do an AM demodulation by multiplying the signal with a square or sine wave of the amplitude and phase of the carrier signal, afterwards do some lowpass filtering (40 Hz).
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • Scriptstart function

    I want to use the function scriptstart to run a VBScript and call a function that is defined within this script. Everything works fine until I try to call a function that requires parameters. Then the "vb engine" seems to for the functionname including the brackets.
    The attached files contains a sample that works fine and another sample that does not work.
    Please tell me if this behaviour is a bug or a feature.
    Attachments:
    ni.zip ‏2 KB

    Hi,
    Typically the command SCRIPTSTART is used as start parameter at DIAdem launch time like "DIAdem.exe /CScriptstart(VBName.VBS)". But to call a function or sub routine from a VBS file we recommend to use the command ScriptInclude. With this command it is possible to call functions and sub routines with parameter:
    'Register all functions and procedures of Function_Library.vbs
    Call ScriptInclude("Function_Library")
    'Calling the function for calculating the maximum envelope curve
    Call Calc_Envelope_Max(1,2)
    More detailed information about this you can find in the DIAdem help.
    I hope this solves your problem.
    Kind regards
    Walter Rick

  • Create a continuous brush stroke using a base image? (ex. barb wire, vines, etc )

    Is it possible to create a brush that makes a stroke that's a continuous image and not just an instanced image as per usual?
    I've seen brushes that do this already, I just can't find any information on how they do it.
    Here is an Example
    Any help is appreciated!

    You could do it by stroking a path with a brush multiple times.  Once for the body of the wire — you make the wire rough by using a small splatter brush with close spacing, lots of angle jitter, and a tiny amount of scatter jitter.
    Then stroke again with the barbs or razors.  For regular barbs just give your custom brush a loose spacing, and set angle jitter to Direction.  You could make a multi-barbed brush, but not too long, or the angle jitter would move it off the wire.  Still doable if wire and barbs are on different layers so you could nudge the barbs back into place with FT warp.
    Layer Styles could give the wire depth and realism.
    OK... money where your mouth is time...   Two examples.  I shaped the razer brush with the Pen tool and guides.  The Barb brush was shaped from a DL'd image.  The wire in both instances is an 80% hard round brush (the slight softening to give it a touch of anti-aliassing on the curves).
    Spacing set wide, and Angle jitter to Direction. Those are the only brush dynamics I used.  Bevel & Emboss layer style to give it depth, and  Colour overlay because it is easier to experiment with layer styles.  The barb brush looked a bit thin, so I duplicated the layer a couple of times.  The look better on a black BG with the layer styles.
    I _tried_ to get the affect in your example image, but couldn't do it convincingly.  If I had a better mind's eye view of what I was trying to achieve, I think I'd have been able to do it.  But once you have the brush presets made and saved, it's a very quick and easy to do.
    If you do happen to have access to Illustrator, the Art Brush is pretty damn clever
    Create an Art brush | Adobe Illustrator CC tutorials

  • How can I calculate the slope of an isometric torque curve with a trigger and time increments of 0-30ms, 0-50ms, 0-100ms etc....

    I am analyzing isometric muscle contractions of the quadriceps and want to calculate the rate of force development (not just peak torque) for the torque-time curve.  I want to set a trigger so that the slope of the torque curve is calculated when 7 newton-meters is reached.  From there I'm trying to calculate the slope in time increments of 0-30ms, 0-50ms, 0-100ms, etc....My data is sampled at 2000 Hz and written in text files.  Below is a copy of the VI I have developed so far.  I am very new to programming with LabVIEW but can definitely see its potential!  Any advice would be greatly appreciated. 
    Attachments:
    Dissertation Isometric RFD.vi ‏14 KB

    Fiddler918,
    When trying to implement something like this in LabVIEW, it is often helpful to think about how you would program this function in a traditional text-based language.  Try and break the problem down.  You need to locate the data point in your array that is 7 Nm or greater.  At this point, you will need to grab the data points that are 60 indices (for the 30ms gap, assuming your points are equally spaced 0.5 ms apart), 100 indices (for the 50 ms gap), and 200 indices (for the 100ms gap) ahead of this point in your data file, and calculate the slope using pairs of data points.  
    Here is a general description of a possible implementation of this code:
    You can wire the appropriate column of the data array into a For Loop on the block diagram and have it auto index through the points.  If you right click on the Use the Greater or Equal? function to generate a Boolean that will be true when you want to exit the For Loop.  Right-click on the border of the For Loop and select Conditional Terminal.  This will cause a small stop sign to appear.  If you wire the Boolean to the conditional terminal, the loop will stop at the value that is greater than or equal to 7 Nm.  If you wire the Loop Iteration terminal out of the For Loop to the right, this will give you the index of the value in the column that you’re interested in.  Having this value, you can then use the Array functions to grab the specific data points you need, and numeric functions to perform the necessary math.
    If any of this didn't make sense, the LabVIEW help files are a great resource to use.
    Here is a link to some video tutorials of the LabVIEW programming environment.  They may help you in the development of your code.
    http://www.ni.com/academic/students/learnlabview/
    Regards,
    Jared R.
    Precision DC Product Support Engineer
    National Instruments

  • How can I calculate area under a curve?

    I would like to use an integral equation to obtain positive and negative areas from graphed data. For example, I have a graph representing power for a 24 hour period and want to integrate the curve to obtain daily energy.

    One common way to approximate the area under a curve is to divide it into a series of trapezoids, with the area of each calculated as avg height x width. Then sum the areas.
    So with this table:
    x     

    trapezoid
    1
    0
    3
    2
    6
    11
    3
    16
    23
    4
    30
    39
    5
    48
    59
    6
    70
    83
    7
    96
    218
    You could use this formula in C2, filled down through the rest of the body cells in that column:
    =IFERROR((B3+B2)÷2×(A3−A2),"")
    This calculates the area of each trapezoid.
    The first row is defined as a Header Row, the last row as a Footer Row.  It's important not to have blank row(s) before the Footer Row. The sum formula in the Footer Row in C9 is:
    =SUM(C)
    Of course, the greater the number of x-y data points the better the estimate of the area under the curve.
    SG

  • How to calculate slope of XY curve?

    Hi all,
    I want to calculate the slope of a X-Y curve, for example, amplitude v.s. position. I was trying to use the derivative method but failed. Could anyone help me with this problem? The example vi. is attached.
    Regards,
    Nicky.
    Solved!
    Go to Solution.
    Attachments:
    example1.vi ‏15 KB

    How are you defining "maximum slope".  Is it a simple threadhold (stop when slope >= a set value) or are you looking for the inflection point (calculating on the fly the maximum slope and stopping when it is reached)?  The threshold is a simple comparison.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • I would like to know how to calculate the slope of a xy-graph in different zones of the curve. .

    Is it possible to do it by graphically selecting the segment of the xy-graph curve?

    I think you can incorperate Nadav's suggestion and the attached VI to find a solution. You may want to add another cursor to the xy plot to establish your region of interest for the dervative.
    Jeremy
    Attachments:
    lv61_derivative_on_a_waveform_graph_and_xy_plot.vi ‏60 KB

  • How do I calculate areas under the curves above and below the x axis at 0?

    The xy graph generated is similar to a sinusoidal representing the magnetic intensity of the poles of a motor. For each of the four areas above and below the x axis at 0 I would like to calculate the area then do a variance analysis on the 8 areas. Can anyone suggest a method to calculate each of the 8 areas. See the attached vi to understand better what I'm trying to do.
    Thank you.
    Attachments:
    MIN MAX A.vi ‏16 KB

    Hi all,
    If you are simply looking to do numeric integration, there is built in functionality to do that.  The help file is here:
    http://zone.ni.com/reference/en-XX/help/371361H-01/gmath/numeric_integration/
    You will may have to do some edge checking if you want to break this down into individual components.
    Let us know if you need any more assistance
    Applications Engineer
    National Instruments

  • Integral of waveform graph to calculate area under curve over time

    Hello ,
    Please find my attached VI and please help me for integration to get area undercut for my waveform graph.
    I would like to find total  Energy output from my wind power  waveform graph oever one month period of time.
    I believe i have to integrate to get area under curve and so i m now using integral tool in labview as attached. 
    As I don't have expected ans for my result and so i want to make sure the tool that i m using is correct.
    Please advise me which method of integration shall i use for my graph.
    Solved!
    Go to Solution.
    Attachments:
    Wind data only.vi ‏134 KB
    wind data.txt ‏1253 KB

    I don't know about your calculations to get the Wattage.  But as far as integration, you really should supply a dt (sample rate) in order to get a proper energy measurement.  I would use your second integration method (the one with "Result" as the indicator) and give it the dt as well.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for