FlexPro
HistoryBase
Engineering
Training
Downloads
FlexPro-Support
Wissen
Community
Über Uns
Referenzen
Jobs
Allgemeiner Kontakt
Händlerverzeichnis
FlexPro-Support
DE
EN
FR
Placeholder
Produkte und Lösungen
Support und Downloads
Unternehmen
Magazin
Kontakt
Sprache
MyWeisang

Account Einstellungen

Topic

Event Isolation: Scaling only positive parts of a signal

Startseite ' Community ' FPScript ' Event Isolation: Scaling only positive parts of a signal

Anzeigen von 3-Stellen - 1 bis 3 (von insgesamt 3)
  • Autor
    Beiträge
  • #33402
    Bernward Grewe
    Teilnehmer

    I want to scale the positive parts of a signal only. A loop over each value takes too much time.

    #33400
    Bernward Grewe
    Teilnehmer

    I want to scale the positive parts of a signal only. A loop over each value takes too much time.

    #33401
    Bernhard Kantz
    Teilnehmer

    This is a typical case for using the FPScript functions of the Event Isolation group.

    The following formula returns a signal where all positive values are scaled by a factor of 5:

    [code]
    Dim idx, s
    idx = ValuesAboveLevel(Signal, 0, EVENT_INDEX)
    s = Signal
    s.y[idx] = s.y[idx]* 5
    s
    [/code]
    The call of [b]ValuesAboveLevel[/b] returns the indexes of all values in the given signal which are higher than zero. [b]s.y[idx][/b] extracts all these values from the Y component of the signal and scales them by 5. Then an index assignment is done to replace the values, found in the signal with the scaled ones.
    The last statement [b]s[/b] just makes sure that the whole signal is returned as the result.

    As you can see in this example, working with indexes is a powerful feature of FPScript. You could also call [b]ValuesAboveLevel[/b] in a way, that it returns the values found, but then the position information would be lost. Once you have found the positions of “events”, you are free to perform any further processing with them. Typical uses are:

    [ol]
    [li]Finding events in one data set and processing them on a different dataset.[/li]
    [li]Combining multiple events by using the Boolean functions [b]IndexAnd[/b], [b]IndexOr[/b] and [b]IndexNot[/b].[/li]
    [li]Sequencing different events by using the [b]Next…[/b]-type of functions, e. g [b]NextValueAboveLevel[/b].[/li]
    [/ol]

    support@weisang.com

Anzeigen von 3-Stellen - 1 bis 3 (von insgesamt 3)
  • Du musst angemeldet sein, um auf dieses Thema antworten zu können.