Hello,
Is it possible given two vectors, A and B, create a third vector, C,
using the following conditions, without a loop?
D = A - B
If D(i) * D(i-1) < 0 and D(i) > 0 then C(i) = 1
If D(i) * D(i-1) < 0 and D(i) < 0 then C(i) = -1
If D(i) * D(i-1) > 0 then C(i) = 0
---
If D(i) * D(i-1) = 0 then
If D(i) * D(i-2) < 0 and D(i) > 0 then C(i) = 1
If D(i) * D(i-2) < 0 and D(i) < 0 then C(i) = -1
If D(i) * D(i-2) > 0 then C(i) = 0
end
Basically I am creating a function that detects when a function
crosses under or over another function or a constant level ...
This was what I came up with ...
... the second part is because sometimes the values can be equal
before the cross occurs ...
I am trying to make this with vectors.
Thank You,
Miguel
shapper - 15 Feb 2008 16:38 GMT
> Hello,
>
[quoted text clipped - 32 lines]
> Thank You,
> Miguel
Ooops, forget it. I posted this on the wrong group.
Sorry,
Miguel