LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to group consecutive equal values from an array X and compute the average of the corresponding values in an array Y?

Solved!
Go to solution

Hi altenbach,

 

This is a cool solution to my problem, although the nonlinear model of the curves I generate, comes from quite a variety of different sources, like BJT, JFET and MOS and the I-V characteristics of those transistors are piecewise-defined functions, with different behavior in each region so it makes it hard to do define a correct nonlinear model.

 

So I'm trying to get around by finding a way to an classical approach of averaging the data, is there some resources about it in the forum?

 

Thank you sincerely,

Wen

0 Kudos
Message 11 of 14
(323 Views)

This is a very simplistic way to average before plot. To every point, grag a subarray and average the data. Then plot XY. 

 

Download All
0 Kudos
Message 12 of 14
(308 Views)
Solution
Accepted by topic author Whens_Wens_Day

@Whens_Wens_Day wrote:

Hi,

 

Cordm's solution looks amazing but I don't really understand your data flow.

Whens_Wens_Day_0-1747240728509.png

What are the inputs for the sum_grid_values? And the cluster of arrays you introduce in Inicialize array is the sorted and deduplicated X values? And the other 2 inputs? Can I have a look of the vi?

 

Wen


The input tunnels from top to bottom are x, y, {sum, n} cluster array for summing y values for the same x, and the x-grid. Look at the wires with probes to see what is going on.

Threshold 1D array finds the closest match to the x-value on the grid, which is used to index into the summation array.

The LV 2019 version includes the map version, the LV2012 version does not.

Download All
0 Kudos
Message 13 of 14
(297 Views)

@Whens_Wens_Day wrote:

This is a cool solution to my problem, although the nonlinear model of the curves I generate, comes from quite a variety of different sources, like BJT, JFET and MOS and the I-V characteristics of those transistors are piecewise-defined functions, with different behavior in each region so it makes it hard to do define a correct nonlinear model.


A polynomial of sufficient order as shown can fit anything and does not need any theory.

 

You can create a VI that uses different nonlinear models based on the input. Right now, all you do is cosmetics. A real model would provide you with relevant parameters that have meaning!

 

("Piecewise" in nature is rare. Often a suitable model can do all regions at once. Your problem is that both x and y are quite noisy and fitting typically assumes noiseless x)

0 Kudos
Message 14 of 14
(280 Views)