# Forum FlexPro – Discuss your topic!

## How to create an "accumulate" view of a periodic signal?

Home > Community > FPScript > How to create an "accumulate" view of a periodic signal?

Ansicht von 5 Beiträgen – 1 bis 5 (von insgesamt 5)
• Autor
Beiträge
• #12528

The signal i have to examine is similar to a dirty rectangular periodic signal.
I want to extract successive rectangles and paste one upon the other in one diagram.
The extraction period of one wave may start by an trigger point. The extraction periode lenght can be fixed by no. of indices or time on the x- axis.
The the diagram has one x-axis for all rectangles, relatively scaled to the start of the extraction periode.
The view i like to generate is commonly called “accumulate view” at digital storage oszilloscopes.
I think this should be possible with FPScript.

#8856
Bernhard Kantz
Teilnehmer

In FPScript there are different possibilities to solve this problem. For example you can write a for-loop where you can collect the data of a period. Or you can change the y dataset into a matrix with n values each data series. n is equal to the number of values per interval. If you create a lines diagram the periods lie one upon the other.

``````
//period length: no. of indices
dim trigger, period, s, dx, i, result
trigger = 10
period = 120

s = Signal[trigger,-1] // signal begins at the trigger point
Reshape(s.y,{NumberOfValues(s)/period,period})

//period length: time
period = 1 //1 second
dX = Mean(s.x[1, -1] - s.x[0, -1])
period = Integer32(period / dX)
Reshape(s.y,{NumberOfValues(s)/period,period})
``````
#8857

Thank you, smart, i tried that.
Unfortunately, i think i did not detail enuogh.

The e.g. rectangular signal waves are not spaced equidistant!
With equidistant, sucessive extraction windows the signal overlays sweep through the accumulate view diagramm.

What i need is that EACH extraction Periode starts at the index (or time) of a LevelCrossing

#8858
Bernhard Kantz
Teilnehmer

1. Use LevelCrossings() to find the index positions of all waves. The number of waves is the length of the index series minus one.
2. Use Maximum(idx[1, – 1] – idx[0, -1]) to compute the maximum wave length.
3. create a series with maximum length times number of waves void values.
4. Loop across the source signal, extrace each wave and put it into to proper possion in the result series.
5. Reshape the series into a data matrix.
The matrix could have one wave in each column. At the end of each column may be some void values.
#8191

The signal i have to examine is similar to a dirty rectangular periodic signal.
I want to extract successive rectangles and paste one upon the other in one diagram.
The extraction period of one wave may start by an trigger point. The extraction periode lenght can be fixed by no. of indices or time on the x- axis.
The the diagram has one x-axis for all rectangles, relatively scaled to the start of the extraction periode.
The view i like to generate is commonly called “accumulate view” at digital storage oszilloscopes.
I think this should be possible with FPScript.

Ansicht von 5 Beiträgen – 1 bis 5 (von insgesamt 5)
• Du musst angemeldet sein, um auf dieses Thema antworten zu können.