How to interpolate/extract row from essentially 1-D lookup table
Show older comments
I have an n x 3 matrix of backEMF values (one per phase) that all map to the same n x 1 vector of position data. For a given position, I would like to interpolate the backEMF value of each phase in the most efficient way possible.
I can use 3 1-D lookup tables (one per phase), but that seems wasteful with respect to re-calculating the index and fraction and then the interpolation definitely isn't parallelized. I could also use a single 2-D lookup table with the 2nd dimension of breakpoints set to [1,2,3] and the second input also set to [1,2,3] but that seems innefficent as it is now doing a 2D lookup for each value. I also looked at the Prelookup->Interpolation Using Prelookup both in parallel (one per phase) and a 2-D "vectorized" version in which the 'Number of subtable selection dimensions' is set to 1 with an input of [0 1 2] (I couldn't get it to give all three results otherwise, only the first two with an input of [0 1 2] and [0 0 0]) and it performs somewhere between the 3*1D table look ups and the 2D table lookup block.
Matlab does a great job vectorizing things and I would love to take advantage of that for this application.
I am essentially looking for the equivalent of the Selector block having "Select all" as an Index Option. If that's not possible, then I'll probably go with the 2D table lookup as it's consistently slightly faster than the 2D prelookup method and much faster than the other two.
Cheers!
Accepted Answer
More Answers (0)
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!