LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Please tell me how to use the selection function(選択関数の使い方について)

Solved!
Go to solution

Please tell me how to use the selection function. The waveform graph shows CH0 and CH1, and the waveform graph 2 shows CH2 and CH3. FFT processing is performed on all 4 channels. 1) If the frequency of CH2 is within the range of CH0+1 to CH0-1, the frequency and amplitude of CH2 will be shown as 0; if it is outside the range, CH2 will be shown. I am processing using a selection function, but there are no problems. 2) On the other hand, if the frequency of CH3 is between CH1+1 and CH1-1, CH3 will be displayed, but if it is outside the range, the frequency and amplitude of CH3 will be set to 0. The selection function reverses the T and F parts, but all 0s are displayed. Could you please fix the block diagram? Please let me know the reason if possible.

 

Japanese

選択関数の使い方について教えてください。
波形グラフからはCH0とCH1、波形グラフ2からはCH2とCH3が示されます。4チャンネル共にFFT処理を行います。
1) CH2の周波数がCH0+1からCH0-1の範囲の場合は、CH2の周波数と振幅は0として、範囲外の場合はCH2は示されます。選択関数を利用して処理をしていますが、問題はありません。
2) 一方、逆にCH3の周波数がCH1+1からCH1-1の間の場合は、CH3は示されますが、範囲外の場合はCH3の周波数と振幅は0とします。選択関数はTとFの部分を逆にしていますが、全て0表示されてしまいます。
ブロックダイアグラムを直して頂けないでしょうか?出来れば原因も教えてください。

Block diagrum.png

0 Kudos
Message 1 of 7
(472 Views)

I asked you to refer to the png file, but all the calculations in the red part are displayed as 0. What I want to do with the red part is to display the value if it is the same value in the comparison calculation, and to set it to 0 otherwise. P.S. In the black part, if the values are the same in the comparison calculation, it will be 0, and if the values are not the same, that value will be displayed.

DIAGRUM.png

I kindly thank you.

 

0 Kudos
Message 2 of 7
(436 Views)

Exact comparison (Equal) of floating point numbers in computers is NEVER a good idea. 0.3 in your indicator may look like an exact number but in a computer can be in reality 0.3000000000000000012..

The next value might be 0.3000000000000035 due to rounding errors, measurement deviations and many more things. They both look like 0.3 but are for a computer simply different numbers.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 7
(424 Views)

Hi kozuka,

 


@kozuka32 wrote:

all the calculations in the red part are displayed as 0.

 

What I want to do with the red part is to display the value if it is the same value in the comparison calculation, and to set it to 0 otherwise.


Your requirement is to "set to 0 if unequal" - and that's what your loops do!

Right now your inner loop outputs the result of the comparison using the LAST element of each column in "Indicator 1". Is this what you want?

 

Maybe you should refine your requirements!?

 

Comments:

  • You should NEVER compare floats for equality, this can often fail!
  • You should simplify & cleanup your VI:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(422 Views)

Hi GerdW

I am always grateful for your help. It's a big help. I tried modifying the diagram. All evaluations are based on integers. Even so, the parts in the red frame are not improved. If indicator 1 is 1,2 and indicator 2 is 1,2,3, the first line of Result1 will be 0,0,3 and the second line will be 0,0,0. . There is no problem with the first line of Result1, but I would like the second line to be 1,2,0.

DIAGRUM.png

0 Kudos
Message 5 of 7
(377 Views)
Solution
Accepted by topic author kozuka32

Hi kozuka,

 


@kozuka32 wrote:

If indicator 1 is 1,2 and indicator 2 is 1,2,3, the first line of Result1 will be 0,0,3 and the second line will be 0,0,0. . There is no problem with the first line of Result1, but I would like the second line to be 1,2,0.


Please use the words "row"/"column" instead of "line"…

 

Suggestion:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(345 Views)
Solution
Accepted by topic author kozuka32

Hi GerdW

 I am always grateful for your help. solved. LabVIEW is very difficult and I am struggling a lot. Sincerely.

Kozuka

0 Kudos
Message 7 of 7
(335 Views)