Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
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
Solved! Go to Solution.
Reply to your PM
@Kishore1 wrote:
Hi Werner,
The file (WE_20190819_Forum.mcdx) which you have attached is not able to open with the current version of Mathcad Prime 4.0 64-bit which am using in my PC.
I have attached my worksheet in same thread where i asked the previous question.
Thanks & Regards,
Kishore
You did not state which version of Prime you use and the files I attached were created with the current Prime 5.
Unfortunately Prime is built that silly so that you can't tell with which version a worksheet was created and older versions can't read a sheet created by a newer one. The most bad is that Prime can't save its sheets in older formats, so the only ways to "convert" a sheet from Prime 5 to Prime 4 are to either retype the whole or to have both versions installed, open both and copy every region one by one to the P4 sheet.
I did the last and attach the P4 worksheet here.
Thank you Luc.
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
Attach a mathcad/Prime WORKSHEET, not just a picture...
Luc
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!
Reply to your PM
@Kishore1 wrote:
Hi Werner,
The file (WE_20190819_Forum.mcdx) which you have attached is not able to open with the current version of Mathcad Prime 4.0 64-bit which am using in my PC.
I have attached my worksheet in same thread where i asked the previous question.
Thanks & Regards,
Kishore
You did not state which version of Prime you use and the files I attached were created with the current Prime 5.
Unfortunately Prime is built that silly so that you can't tell with which version a worksheet was created and older versions can't read a sheet created by a newer one. The most bad is that Prime can't save its sheets in older formats, so the only ways to "convert" a sheet from Prime 5 to Prime 4 are to either retype the whole or to have both versions installed, open both and copy every region one by one to the P4 sheet.
I did the last and attach the P4 worksheet here.