How do I plot an exponential average of a 1D array?

I'm capturing a 32,768 point array of data from a digitizer in my PC, and I want to be able to average n number of these arrays with a exponential average. (e.g. if n=30, I would plot the average of the previous 30 arrays of data, and then continue to average excepts now applies a weight to "old" arrays which would gradually tend to zero.) I had this function in an old Lecroy 9350 oscilloscope, and it's referred to there as  a "Continuous" Average. 

Sorry about the delay, and thanks for the great advice.
I've attached a screenshot here of my block diagram. I have two problems now:
1) there are multiple traces on my plot when there should only by one(see attached screenshot #2)
2) it still doesn't seem to be doing continuous averaging correctly. I'm running this experiment and triggering my scope at 10Hz, but the data I'm seeing plotted is only updating every second or two.In addition, there seems to be no memory of the old shots. Say for example I set the # of averages to 50, and then block the signal to the scope-I don't see the trace gradually trent back to zero. Instead, it immediately drops to zero. Hopefully this all makes sense, and thanks again for the help. 
Attachments:
Block Diagram.png ‏77 KB
Front Panel.png ‏112 KB

Similar Messages

  • How do I plot multiple points (scatter) on the same graph?

    Hello,
    I have a graph with a fixed X-axis and an array of Y values which varies. How do I plot these new y values without replacing the previous ones? E.g to have a scatter of new data? Example of shown in Figure 1 below:
    Figure 1: (Note: image was photoshopped to demonstrate goal) 
    Figure 2: Current block diagram, LabVIEW VI:
    Thank you!
    Solved!
    Go to Solution.

    Think about what you are really building. You are building an array of clusters, right? For each element in the array you have a cluster whos content has a value for the X axis and a value for the Y axis. As long as you are not connecting the datapoints in the graph (which you aren't), you can plot the datapoints in any order. If you are building your X portion of the cluster seperately than your Y portion of the cluster, you just have to make sure the indexes do not get transposed somehow.
    Build the lower half of the attached picture, and you will see what I mean. (hopefully)
    Attachments:
    Chart.PNG ‏21 KB

  • How can I plot the 3d plot of a vibrating bridge?

    Dear all
        My question is as follows:
        I want to plot the mode shape of a bridge. Now the deck of the bridge is vibrating, which can be plot. But at the same time; I want to plot the column of the bridge
    The question is: when some surface of the 3d plot are vibrating, which  means animated plot.How can I plot  the stationary multiple curves at the same time.
    The attached file is one example, but always the mutiple curves disappear when the surface vibrating.
    PS: My VI version is 8.0 How can I save the VI as version 7.x or 6.x, version 8.x seems too new.
    Any reply will be appreciated! Many thanks!
    Attachments:
    format line plot.vi ‏32 KB
    3D plot of mode shape.vi ‏33 KB
    format 3D.vi ‏31 KB

    Sorry,the attached VI should be as follows since there is not data in the array in the previous VI
    Attachments:
    format surface plot.vi ‏20 KB
    3D plot of mode shape.vi ‏31 KB
    format 3D.vi ‏27 KB

  • How can I get max, min & average (hours with minutes) of fast 30 days data

    Table name:
    run_log
    TYPE VARCHAR2(10),
    SUBTYPE VARCHAR2(10),
    PROGRAM VARCHAR2(100),
    STATUS VARCHAR2(20),
    START_TIME      DATE,
    END_TIME      DATE
    How can I get max, min & average (hours with minutes) of fast 30 days data ?

    Hi,
    you have to use analytical functions:
    SELECT start_day,
           round(AVG(daily_avg)
                 over(ORDER BY start_day ASC RANGE BETWEEN INTERVAL '30' DAY preceding AND INTERVAL '0' DAY following)) AS moving_avg,
           round(MAX(daily_max)
                 over(ORDER BY start_day ASC RANGE BETWEEN INTERVAL '30' DAY preceding AND INTERVAL '0' DAY following)) AS moving_max,
           round(MIN(daily_min)
                 over(ORDER BY start_day ASC RANGE BETWEEN INTERVAL '30' DAY preceding AND INTERVAL '0' DAY following)) AS moving_min
      FROM (SELECT trunc(t.start_time) start_day,
                   AVG((t.end_time - t.start_time) * 24 * 60 * 60) AS daily_avg,
                   MAX((t.end_time - t.start_time) * 24 * 60 * 60) AS daily_max,
                   MIN((t.end_time - t.start_time) * 24 * 60 * 60) AS daily_min
              FROM run_log
             GROUP BY trunc(t.start_time)) t
    ORDER BY 1 DESCAnalytical functions are described in the Oracle doc "Data Warehousing Guide".
    Regards,
    Carsten.

  • How do I plot two variables when neither are time?

    I know how to plot a variable against time, but how do I plot two variables when neither one of them are time against each other. For example if I want to plot say force against distance what is the best approach to use?
    Thank you.
    Solved!
    Go to Solution.

    Use an XY graph. Use Context Help to see the expected datatype, and refer to examples. Consider the following, remembering to rename the Scale Labels and Plot Name:
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • How to get Material Master Moving average price into Purchase Order

    Hi,
    How to get Material master moving average price into purchase order instead of Purchase Info record.
    Thanks,
    Sridhar

    Hi,
            I  cannot understand whether it is necessary .
           How about as following step?
                 1. create Purcahse requisition
                                Price come form moving average price in material master.
                 2. Create Purchase order reference Purchase  requisition
                                There is a setting  from the unit price of P/R onto the unit price of P/O.
      Regards,
         Gaito

  • How the LMS 4.2 calculate average interface Utilization

    Hello!
    I have interface Tunnel1 with bandwidth 5000.
    How the LMS 4.2 calculate average interface RxUtilization or TxUtilization on this interface?

    Hi ,
    Below is how LMS calculates this value:
    RxUtilization = (ifInOctets*8*100)/ifSpeed   
    TxUtilization = (ifOutOctets*8*100)/ifSpeed
    Thanks-
    Afroz
    ***Ratings Encourages Contributors ***

  • How do I plot bar graph using MStudio.NE​T for VB

    I can not find the FillToBase property in waveformplot object using MStudio 7.0 for VB.NET. How can I plot the bar graph like that in Mstudio 6.0.

    The Measurement Studio .NET WaveformPlot does not currently have an equivalent for CWPlot's FillToBase property. In the meantime, though, you can use the WaveformPlot's custom drawing services to emulate this functionality. For example, if you dropped a new WaveformGraph on a form, you could copy and paste the following code to draw bar graphs on the WaveformPlot:
    Private Sub OnBeforeDrawPlot(ByVal sender As Object, ByVal e As BeforeDrawXYPlotEventArgs) Handles WaveformPlot1.BeforeDraw
    DrawBarGraph(e, 0, Color.BurlyWood, Color.Firebrick)
    End Sub
    Shared Sub DrawBarGraph(ByVal e As BeforeDrawXYPlotEventArgs, ByVal baseYValue As Double, ByVal outlineColor As Color, ByVal fillColor As Color)
    Dim plot As XYPlot = e.Plot
    Dim g As Graphics = e.Graphics
    If plot.HistoryCount > 0 Then
    ' Clip the data to just what will be drawn with the current axis ranges.
    Dim xData() As Double, yData() As Double
    plot.ClipData(xData, yData)
    ' Calculate the screen coordinates of a base y value and the clipped data.
    Dim baseY As Double = CType(plot.MapPoint(e.Bounds, 0, baseYValue).Y, Double)
    Dim points As PointF() = plot.MapData(e.Bounds, xData, yData, False)
    Dim outlinePen As Pen = Nothing
    Dim fillBrush As Brush = Nothing
    Try
    outlinePen = New Pen(outlineColor)
    fillBrush = New SolidBrush(fillColor)
    ' Iterate through the mapped points and calculate the bar, fill it, and outline it
    For i As Integer = 0 To points.Length - 2
    Dim currentPoint As PointF = points(i)
    Dim nextPoint As PointF = points(i + 1)
    Dim barX As Single = currentPoint.X
    Dim barY As Single = currentPoint.Y
    Dim barWidth As Single = nextPoint.X - currentPoint.X
    Dim barHeight As Single = baseY - currentPoint.Y
    g.FillRectangle(fillBrush, barX, barY, barWidth, barHeight)
    g.DrawRectangle(outlinePen, barX, barY, barWidth, barHeight)
    Next
    Finally
    If Not outlinePen Is Nothing Then
    outlinePen.Dispose()
    outlinePen = Nothing
    End If
    If Not fillBrush Is Nothing Then
    fillBrush.Dispose()
    fillBrush = Nothing
    End If
    End Try
    ' Cancel any further drawing since we completely handled the drawing of the plot.
    e.Cancel = True
    End If
    End Sub
    Hope this helps.
    - Elton

  • Running Average 2D(or more) Array Graphed

    I am really confused on how to plot the running average for my data. I allow the user to say how many data points they want averaged. The user can also collect up to 32 channels of data @ 1000hz.
    I understand averaging a 1D array, but how do I simultaneously plot averages when its a 2D,3D,etc array? By that I mean plot the average value for channel 0 at the same time as channel 1 at the same time as channel 2...
    Any help is appreciated, thanks!
    Lauren

    Lauren,
    It sounds like you would like to extract each channel from the 2D data array so that you can average them simultaniuosly. The best way to do this is by wiring the 2D array to the input of index array function. The funtion will morph to have an input for index(row) and index(col). You can extract one channel of the 2D array by wiring a constant to the column input. The output of this function is then a 1D array that you are used to averaging. Becasue using 32 of these may become cumbersome the function could be placed inside of a loop and the loop iteration could control the row to extract each iteration of the loop. I hope this resource helps!
    Regards,
    Shea C
    Applications Engineering
    NI

  • Running Average of a 2D array element-wi​se

    Hello all,
    I am having trouble approaching this problem. I have a sub-VI which outputs a 2D-array for each iteration of a while-loop. This is spectroscopic data set where the first column is the time value and the next 32 columns are intensities from the array detector. RIght now I am fine with just figuring out how to solve my problem with only two columns. 
    Anyways, I want to be able to save the array between iterations ( which I am implementing a shift register for) and then average the next array with the previous saved array. Since all my time points will be equivalent in between iterations (the sub-VI creates a special time axis), I want to do a straight running average where each element is averaged with the previous corresponding element in the array. 
    What would be the best way to approach this part? Should I just do a build array and at the end somehow iteratively average together all of the appended arrays? I figure that would take way too long compared to a running average though. 
    Thank you for your help. I can clarify further if anything seems unclear. 

    Try using index array for elemenet by element averaging for both the arrays. You dont need buid array anyways.
    One more question, if some points are same then do averaging of those elements which are not equal or expected to be different.
    Do you have any sample data. It will be great if i have some data on which operation needs to be performed.
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

  • Running average of a 2d array

    Hi,
    I am trying to get a running average but my data is a 2D array. How do you get arunning average of a 2D array. Any suggestions?
    cheers
    lp19

    Convert it to a 1D Array, and then use the existing running average tools. You can convert a 2D array to a 1D array using the "Reshape Array" function. You will need to provide this function a "length" argument, which is calculated a the product of the row-length and column-length of your 2D array. The way that I calculate this is to use the "Muliply Array Elements" function on the "size(s)" output of the "Array Size" function (see the attached image file).
    Good luck,
    -Jim
    Attachments:
    2Dto1D.JPG ‏5 KB

  • Consumer loop very slow, queue size grows. How to speed up my consumer loop? As the array grows the slower it gets.

    LabView version: 2012
    OS: Windows XP SP3
    Hardware: USB NI cDAQ-9174 NI-9221
    Application: Oscilloscope
    I'm relatively new to LabView and I'm currently experiencing some performance issues with my project. I guess it has something to do with the way it's programmed. I'm hoping to get some tips from you guys.
    This is my producer loop. It should be capable of acquiring 100 000 Samples/s. I guess I've done this the right way and can't really be improved. Or am I mistaking?
    This is (part of) my consumer loop. It's too slow, the number of elements in the queue keeps getting bigger. I'm doing two types of calculations on the queue data. One for changing the scalling (a multiplication), one for changing the y-position (a summation). Because each time there are 10 000 samples acquired I have added an extra loop (inner loop). This loop splits the array into x samples when the requested samples are smaller than 10 000 or adds them when the requested samples are bigger than 10 000. This depends on the user input (time/dev).
    For example: when the user request 100 seconds of data to be plotted on a graph we get an array of 10 000 000 x 8. Is this considered big? Enlarging the array to that size is very very slow, the queue builds up rapidly.
    I don't know what really slows it down or how to 'debug' this properly. Transposing the array twice seems avoidable?
    Maybe I'm doing this in an inefficient way? Any thoughts that might help me?
    The VI's are attached.
    Thanks for your input.
    Attachments:
    Scope.zip ‏199 KB

    Thank you for your replies so far!
    LV_Pro,
    I agree it is a bit silly to plot more than 2000 points. I will change this. But even without a graph, the consumer loop seems to be unable to handle the speed.
    tst,
    1. Ok, I will change this
    2. Thank you for pointing this out. I implemented your technique and have some increased performance.
    Still not the speed I would expect from LabView. The system is 'stable' with a sample rate up to 100 Hz, increasing this makes my queue overflow.
    I must be doing something else wrong... Anymore ideas?
    Latest version of program in attachment.
    Attachments:
    Scope 1.zip ‏211 KB

  • How do i convert an image object to a byte array ?

    Hi
    how do i convert an image object into a byte array
    early reply apperciated

    Oh sorry my method and the other method need to have the pixels from the Image passed to them which you get my using pixelgrabber:
    //create width and height variables from image
              int w = img.getWidth(this);
              int h = img.getHeight(this);
              //retrive picture from image
              int[] pix = new int[w * h];
              PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pix, 0, w);
              try{ pg.grabPixels();
              } catch (InterruptedException ioe) {
                   System.err.println("Interrupted");
              if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
              System.err.println("image fetch aborted or errored");
              }

  • How can i save the values of output waveform in array ?

    hi
    how can i save the values of  output waveform in array ?

     how can i save the values of  output waveform in array ?
    the program is attachment bellow
    Attachments:
    closed loop transfer fn+fuzzy.vi ‏28 KB

  • How can i asign value to variables stored in an array of string?

    hi
    how can i asign value to variables stored in an array of string. i need to do it so that i can evaluate a math expression by usin those values. for example, i have a string array like [x, y, z, k]. now i need to asign 2.0 to x, 3.0 to y and so on. then if i type x+y, the program should evaluate the expression by usin x=2.0 and y=3.0. i am usin JEP for parsing and evaluating.
    any help or suggestion would be much apreciated.
    here is how i got the array
    System.out.println("Type first expression");
    BufferedReader br1 = new BufferedReader( new
                         InputStreamReader(System.in));
    String expression1 = br1.readLine();
    Jep jep = new Jep();
    Node node1 = jep.parse(expression1);
    TreeAnalyzer Ta1 = new TreeAnalyzer(node1);
    Map<Variable, Integer> map1 = Ta1.getVariables();
    /**The following will convert the variable names to a sorted array*/
         /**with the result in varNames.*/
    String[] res1 = new String[map1.size()];
                int i=0;
                for(Variable v:map1.keySet())
                    res1[i++]=v.getName();  
    System.out.println(Arrays.toString(res1));

    I could not use HashMap as those variables are to be retrieved from any expression typed by user and thus unknown to me beforehand.
    System.out.println("Type first expression");
    BufferedReader br1 = new BufferedReader( new
                         InputStreamReader(System.in));
    String expression1 = br1.readLine();
    Jep jep = new Jep();
    Node node1 = jep.parse(expression1);
    TreeAnalyzer Ta1 = new TreeAnalyzer(node1);
    Map<Variable, Integer> map1 = Ta1.getVariables();then i have converted them to a sorted array
    String[] res1 = new String[map1.size()];
                     int i=0;
                     for(Variable v:map1.keySet())
                         res1[i++]=v.getName();              
                     System.out.println(Arrays.toString(res1));now i need to assign random double values to those variables.
    and then use those double values for variables when evaluating the expression.
    pls help.

Maybe you are looking for

  • RGB and Smart Objects

    When I place separate images into my CMYK master document, should I be placing them as smart objects and preserving their RGB values? Is there any benefit or detriment to doing that? I imagine it's good to preserve the RGB values, but if I am always

  • Positioning cursor in texteditor

    Hi all,      How to set cursor in texteditor control in dynpro. Regards, bala

  • Case of the missing 15GB...

    Hi, I have a really strange problem with some missing Hard Disk space. I installed boot camp and had a 15GB Windows partition working fine. It all went a bit wrong when I tried to remove the partition. I used the boot camp assistant to remove the par

  • Username changed - icloud does not recognize it..

    I have changed my username and now I cannot synchro my iCloud and I cannot find where to change it, both on my iPad and on my mac, can anybody help me ?

  • Wifi works on Windows laptop but not macbook - help please!!

    Hi! I'm a new customer to Verizon having just moved to the US from the UK. We have the DSL service with the 7500 Westell router. I've set up the wireless and it works fine on my husband's laptop (IBM thinkpad with Windows XP) but my MacBook just will