How to interpolate across 2D Matrix with 3 known parameters?
8 views (last 30 days)
Show older comments
Hello all, I will try to make this as clear as possible.
I've attached my .txt file but if you cannot see this, it looks like the screenshot below.
I have already imported the data into MATLAB using textscan where the x data is my desired variable, Velocity. So I showed the first three configurations but there are many more matricies. The way I have it imported in matlab is as a double type matrix with all that data like shown in the text file (not sure if this is the best way for what I'm trying to do)
The top left corner of the matrix shows the configuration. For example, each Velocity matrix has a different values for configuration 20, configuration 21, and configuration 22.... etc.
Each matrix has the left column side varying in position (0.00,0.01,....etc) and the top row varying in height (0,5,10,15)...
I hope I explained that well. Basically I am trying to interpolate across configuration, position, height, to find a new velocity ('x' values).
I am not even sure if it's possible to do this interpolation. For instance, I want to know the value of Velocity at configuration 20.5 (inbetween 20 and 21) at a known position .05 and known height 10. Is this possible?
configuration = [20,21,22...etc] (A simple vector of known values from data -- I grabbed this from the imported data.)
Position = [0.00 0.01 0.02....etc] (These are the same for all matricies).
Height = [0,5,10....etc] (These values are the same for all matricies.
I tried to use interpn vq = interpn(Position,Height,configuration,Velocity,0.05,10,21,'linear',-1). I am just confused on how I would do this across the different configuration or if its even possible?? Do I have to reformat how I stored the data?
Thanks so much for your time to read it!!
0 Comments
Accepted Answer
Matt J
on 29 Sep 2020
Edited: Matt J
on 29 Sep 2020
I am just confused on how I would do this across the different configuration or if its even possible?
You interpolate between Configuration values just as you would interpolate between Position and Height, e.g.,
vq = interpn(Position,Height,Configuration,Velocity, 0.055,10.3,21.6, 'linear',-1)
There is nothing more special about the Configuration coordinate axis than the other coordinate axes.
3 Comments
Matt J
on 29 Sep 2020
Yes, the data you are interpolating must be in the form of a 3D array if you are interpolating in 3 dimensions.
More Answers (0)
See Also
Categories
Find more on Interpolation 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!