LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate values of array with a function (depending on the values)

Solved!
Go to solution

Hi,

I am looking for a Way to calculate each value of an array with a function and then output the new array. My problem is, that the function refers to the values of the array. So far it only calculates the first value of the array and puts it in a column of the calculated array. The formula is the following: E(New) = C0 + C1*E + C2*E^2 + C3*E^3 + C4*E^4. (Array is filled with varying E)

I read how you can multiply the array with a constant, but could not find a similar problem to my case. I am sure I am overseeing something but can't figure it out.

Any help appreciated. The VI is attached

0 Kudos
Message 1 of 5
(1,548 Views)
Solution
Accepted by topic author Phil7

Hi Phil,

 

why don't you use the polynomial functions provided by NI?

 

Btw. your DAQAssistent only has one channel/signal defined, so using SplitSignal afterwards is pure nonsense!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(1,525 Views)

Because I did not know of it. Thank you, works great.

 

I seperated the signal so I can do the calculation on my array. Does the vi you presented also accept the signal as input?

0 Kudos
Message 3 of 5
(1,495 Views)

Hi Phil,

 


@Phil7 wrote:

I seperated the signal so I can do the calculation on my array.


No need to separate a single signal from a DDT wire containing only this single signal…

 


@Phil7 wrote:

Does the vi you presented also accept the signal as input?


The FOR loop accepts the signal as is shown in the snippet.

I guess I don't understand this question…

Best regards,
GerdW


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

@GerdW wrote:

I guess I don't understand this question…


@Phil7, I think what GerdW was trying to say was that the Split Signal "Splits two or more signals into component signals."

(@GerdW, please correct me if I'm wrong. 😊)

 

So, if you only have one input signal, it doesn't make sense to Split it - just feed it directly into the "Convert From Dynamic Data" (or "Von dynamischen Daten konvertieren", in your case). Like this:

Calc vals of array w function - no splitter.png

If  you need to combine the two signals in your output, you can just branch the wire and then feed it into a "Merge Signals" like you have already done:

Calc vals of array w function - recombine data.png

 

Does that make sense?

-joeorbob

0 Kudos
Message 5 of 5
(1,464 Views)