cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Participant

## comparison of two matrix

Hi,

can i please know the method for this condition.

1st row value of ADC matrix should compare with ADC_LUT matrix and take the next higher and lower value.

for eg-if 3996 from ADC matrix is compared with ADC_LUT matrix , it should take out 3997 & 3968 value from ADC_LUT matrix.

similarly for other value to.

Regards,

Kishore

9 REPLIES 9

Luc

Highlighted

See attachment.

Success!
Luc

Thank you Luc.

## Re: comparison of two matrix

Am doing the interpolation here to find out the temperatures (4x0 matrix) for corresponding values in ADC matrix ,can i please know the method for this condition.

1st row value of ADC matrix should compare with ADC_LUT matrix and take the next higher and lower value from that ADC_LUT matrix and corresponding temperature values from temp matrix and find the desired temperature for eg-if 3996 from ADC matrix is compared with ADC_LUT matrix , it should take out 3997(g1) & 3968(g3) value from ADC_LUT matrix and corresponding temperature i,e -40(t1) & -35(t3) from Temp matrix and interpolate the temperature t2 using the above attached formula for value 3996(g2).

similarly for other values of ADC matrix (4x0) automatically it should compare.

Regards,

Kishore

## Re: comparison of two matrix

Attach a mathcad/Prime WORKSHEET, not just a picture...

Luc

## Re: comparison of two matrix

In case g2=3831 the calculation of g3 must fail because there is no smaller value in ADC_LUT.

We can deal with that case with a try and catch and return NaN for this value:

P5 worksheet attached.

P.S.: If you meant g3<=g2 instead of g3<g2 as you wrote, then you have to replace "lt" by "leq" and can do without the extra function.

Oops, stop! bad idea. You may end up with g1=g3 and this would result in a division by zero. So you should come up with another idea to deal with that case.

Wouldn't it be natural to just use the temperature from temp as it is if the value is exactly in ADC_LUT ?

P.P.S.: For the future - please attach your worksheets, not just pictures!