I have a simple question to the "sample if true" function.
I have a function f that is small almost everywhere but has a big peak at time T, say f = 100 for time=T and else 0.1. So I want to cut the small noise such that only the peak will remain. I thought that I can do this with e.g.
only_peak = sample if true ( f<1, f , 0)
But this only cuts the noise before the peak while after the peak only_peak is a little bit biger than 1. If I select
only_peak = sample if true ( f<2, f , 0)
then only_peak is a littele bit biger than 2 after the peak, and so on.
How can I reach my goal, and why does the condition in the first argument of sample if true impacts the outcome after the condition has fullfilled?
Regards,
Peter
sample if true
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Yes, sounds logically and simple.
My original problem was more complex, and I hoped to use sample if true. But as usual the question becomes trivial if I take it out of the context.
(originally I tried to (almost) deplete a stock say three times serially first if it achieved level a, then if it achieved level b<a and so on; the inflow may be constant, but 0 as long the outflow isn't 0. But this problem hasn't to do with sample if true and so doesn't belong to this thread).)
My original problem was more complex, and I hoped to use sample if true. But as usual the question becomes trivial if I take it out of the context.
(originally I tried to (almost) deplete a stock say three times serially first if it achieved level a, then if it achieved level b<a and so on; the inflow may be constant, but 0 as long the outflow isn't 0. But this problem hasn't to do with sample if true and so doesn't belong to this thread).)
Peter Addor