07-02-2013 02:52 PM
Hello!
I would appreciate some help with this:
- I have an input array X. It is a phase array, in other words, it has values from -pi to pi.
- I want to create digital pulses that match with certain values of phases in X. Example: If a value of X, in position "5", is -3*pi/2, i would like to generate , in the output array Y, a value of 1 in its position "5".
My problem here is that i am not being able to detect the position of the array where my condition is met. I tried to use a case structure and a for to do this, without success.
I hope i was clear enough, thank you very much.
07-02-2013 03:03 PM
Przedzmirski wrote:... If a value of X, in position "5", is -3*pi/2 ...
"Equal" comparisons of floating point values are highly problematic and will typically not work. Can you show us some typical datafile?
07-03-2013 01:22 PM
Yes, you're right, the comparison was just an example. It could be a interval where a value would be in, like -pi/2 to -pi, or something like this. I'll attach a code that i tried to do, but using Threshold 1D array, what definitely not is what i want. Now i'm trying to do some profress with Threshold detector, a nice option to solve my problem, i hope.
07-03-2013 02:05 PM
Can you attach the actual VI instead of a partial picture with hidden wires.
07-03-2013 03:16 PM
There it is 🙂
07-03-2013 03:58 PM
I assume you want to find all transitions, right?
Here is a very simple way to do this. Subtract the threshold from the data and look for zero crossings (defined if the product of adjacent elements is zero or negative). If you select only the upslope crossings, check if the second element is positive and AND the result of both comparisons.
Here is a quick draft. It probably needs a few tweaks....
07-08-2013 03:47 PM
It helped me a lot, altenbach. Thank you very much for your replies. I think this method should work, and I will try to tweak it like u said. I will mark as solution of my problem.
07-23-2013 03:08 PM
Ok, now that i Got the phases, i have to generate the output. Knowing the period of the phases wave and the timing of a certain phase, i want to generate a digital output in a future time that falls in the specified phase. It's a closed-loop of stimulation. What i'm trying to do is this:
- First of all, I get the phases like Altenbach said.
- Then, i do the time calculus to predict time intervals that i would wait to generate my pulse, and that pulse should fall in the specified phase of the input waveform, since its a closed-loop system.
I'm attaching the current vi that i designed, and I appreciate any help.
_________
The real trouble now is generate the output pulse/ boolean in the right time, with a duration of, i dont know, 10ms, just to make it work. something like this: _______| |________
<--10ms-->
Best Regards,
07-30-2013 03:25 PM
Just adding information... I tried to generate the output, and i did it, but im feeling that its not the right way to do it... i would appreciate any help.
The vi is attached.