Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close

Hi
Annyone here know a good algorithm for linear interpolation. I know that oscat lib can provide a block that can do that. But i need the algorithm, so i can make a block my self. I need that bacause i'm making a PID regulator with a gain-scheduling option.

I'm programming the PID in Codesys structured text.

Best Regards
Henrik

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

I'm pretty sure that the formula should be:
(ymax-ymin)/(xmax-xmin)*(value-xmin)+ymin

For me the formula worked perfectly and is used to interpolate values for special needs, w/o using the function from the OSCAT library called LINEAR_INT.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

I'm pretty sure that the formula should be:
(ymax-ymin)/(xmax-xmin)*(value-xmin)+ymin

For me the formula worked perfectly and is used to interpolate values for special needs, w/o using the function from the OSCAT library called LINEAR_INT.

If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

2013-03-16Originally created by:H87Hi

Annyone here know a good algorithm for linear interpolation. I know that oscat lib can provide a block that can do that. But i need the algorithm, so i can make a block my self. I need that bacause i'm making a PID regulator with a gain-scheduling option.

I'm programming the PID in Codesys structured text.

Best Regards

Henrik

2013-03-19if you open the oscat.lib in your codesys as a library, you can see the source code complete it is open source.

easier way is download the txt version. and the pdf along.

If you tell us what you want, we will look into your problem.

btw if it is complicated you can always use fuzzy.

2013-04-03ymax/ymin*((value-xmin)/xmax-xmin)+ymin

2021-03-04I'm pretty sure that the formula should be:

(ymax-ymin)/(xmax-xmin)*(value-xmin)+ymin

For me the formula worked perfectly and is used to interpolate values for special needs, w/o using the function from the OSCAT library called LINEAR_INT.

2021-03-04I'm pretty sure that the formula should be:

(ymax-ymin)/(xmax-xmin)*(value-xmin)+ymin

For me the formula worked perfectly and is used to interpolate values for special needs, w/o using the function from the OSCAT library called LINEAR_INT.