MATLAB Answers

# Interpolation between matrices in Simulink

4 views (last 30 days)
Dogukan Aygun on 8 Feb 2021
Commented: Dogukan Aygun on 8 Feb 2021
Hello everyone,
I am having trouble about interpolating between matrices in Simulink. To explain detailly, I am forming a Flight Model for an aircraft, and I need to use given data sets in Engine Model of my simulation. I have got Thrust Coefficient values for 3 different RPM values and 4 different altitude values. Each of these 12 data sets are formed such that they are a 2D array where x direction is for different Advance Ratio values, and y direction is for different Power coefficient values. I tried to use the 2D and 3D Lookup Tables but they do not make interpolation between two matrices. What I need is for a given altitude and RPM value, interpolate the matrices and find a new matrix as in the image below. Then I can use a 2D Lookup Table for given CP and J values. ##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

Andy Bartlett on 8 Feb 2021
It sounds like you have
3 by 4 by 23 by 6
data points corresponding to
3 rpms, 4 altitudes, 23 CPs, 6 Js
and you want to interpolate across this data using the four values, rpm, altitude, CP and J.
Have you tried using a 4D Lookup Table?
If the 4D Lookup Table does match your needs, then it can be a lot more efficient.
Assuming the four inputs are scalar:
A 4D lookup table internally requires 15 interpolation calculations.
A 2D interpolation across a 23 by 6 matrix would require 414 interpolations, then 3 more interpolations for the final 2D interpolation stage.
If you have reason to breakup the calculations, rather than use 4D Lookup, consider using the prelookup blocks as the first stage.
The prelookup will provide the interpolation factors and the indicies into the needed sections of your 3 by 4 by 23 by 6 data.
Using the indices, you could use a block like a selector to extract just the data for the current output calculations.
This would allow much fewer interpolation calculations than working on the full 23 by 6 matrices.
##### 2 CommentsShowHide 1 older comment
Dogukan Aygun on 8 Feb 2021 Sign in to comment.

R2019b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!