LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate output based on the analysis of a input array

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.

0 Kudos
Message 1 of 9
(2,549 Views)

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?

0 Kudos
Message 2 of 9
(2,542 Views)

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.

0 Kudos
Message 3 of 9
(2,515 Views)

Can you attach the actual VI instead of a partial picture with hidden wires.

0 Kudos
Message 4 of 9
(2,504 Views)

There it is 🙂

 

 

0 Kudos
Message 5 of 9
(2,492 Views)

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....

 

 

0 Kudos
Message 6 of 9
(2,485 Views)

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.

0 Kudos
Message 7 of 9
(2,456 Views)

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,

0 Kudos
Message 8 of 9
(2,419 Views)

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.

0 Kudos
Message 9 of 9
(2,397 Views)