- The Matrix Interpolation block takes the precalculated interpolation index (i.e. which two breakpoints the velocity is between) and the interpolation fraction (i.e. how far between the breakpoints the velocity is) as input. NOTE: This index starts from 0 (not 1 as you might expect).
- It takes the matrices for interpolation as the parameter “Table Data”. In our case, this is a 4x4x3 matrix. It is composed of three 4x4 matrices, each of which corresponds to A, B, C. You can think of this as A, B, C stacked on top of each other.
- The Matrix Interpolation block takes the precalculated interpolation index (i.e. which two breakpoints the velocity is between) and the interpolation fraction (i.e. how far between the breakpoints the velocity is) as input. NOTE: This index starts from 0 (not 1 as you might expect).
- The MATLAB Function block “Calculate Index and Fraction” calculates these values from the velocity value and the interpolation breakpoints.
- It takes the matrices for interpolation as the parameter “Table Data”. In our case, this is a 4x4x3 matrix. It is composed of three 4x4 matrices, each of which corresponds to A, B, C. You can think of this as A, B, C stacked on top of each other.
- The parameter “Table Data” is defined as the variable interpolationMatrix.
- The values in interpolationMatrix are defined in the MATLAB script “loadInterpolationMatrix.m”, which I have configured to run when the model is opened or updated (in the model callback InitFcn).
- Make sure to open "MatrixInterpolationExample.slx" in the same directory as "loadInterpolationMatrix.m" for this to function.