-
FlexPro
- At a Glance
- Features & Options
- Applications
- All Advantages
- What’s New in FlexPro 2021
- Try FlexPro For Free
- FlexPro View OEM Freeware
- Buying Guide
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
- Products
- News
- Support
- Company
- Contact
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
Event Isolation: Scaling only positive parts of a signal
- This topic has 2 replies, 2 voices, and was last updated 20 years, 10 months ago by Bernward Grewe.
-
AuthorPosts
-
January 22, 2004 at 10:42 pm #12534Bernward GreweParticipant
I want to scale the positive parts of a signal only. A loop over each value takes too much time.
January 22, 2004 at 11:12 pm #8197Bernward GreweParticipantI want to scale the positive parts of a signal only. A loop over each value takes too much time.
January 22, 2004 at 11:12 pm #8867Bernhard KantzParticipantThis 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:
Dim idx, s idx = ValuesAboveLevel(Signal, 0, EVENT_INDEX) s = Signal s.y[idx] = s.y[idx]* 5 s
The call of ValuesAboveLevel returns the indexes of all values in the given signal which are higher than zero. s.y[idx] 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 s 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 ValuesAboveLevel 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:
- Finding events in one data set and processing them on a different dataset.
- Combining multiple events by using the Boolean functions IndexAnd, IndexOr and IndexNot.
- Sequencing different events by using the Next…-type of functions, e. g NextValueAboveLevel.
-
AuthorPosts
- You must be logged in to reply to this topic.