Mapping x values and dimensions

Hi all,
I have two sets of data (both containing columns for x, f(x), and g(x)) which I'll need to do some matrix multiplication and plotting with. The issue is that neither the dimensions of the two data sets nor the x values themselves are the same.
I've attached small subsets of the files to illustrate the problem. For the full range of values (200-1100), the test1 data would obviously have many, many more data points.
So I essentially need to rebuild the tests file to contain as many data points as the test1 file, with the same test1 x ("wave") values, and f(x) ("n") and g(x) ("k") values interpolated using the behaviors from the tests data. I suppose I'll also need to delete the real x, f(x), and g(x) values in tests to preserve the dimensions, ultimately leaving me with an entire data set of interpolated data. Does anyone have any elegant or inelegant solutions for this?
Bonus question: I have a third file which I will have to apply the same fix for, but which has one additional problem. The x ("wave") range starts around 250 and ends at 1000 rather than 200-1100. How do I interpolate values at the beginning or end of a data set?
Thanks for the help!

2 Comments

Read about interp1
For your bonus question, interp1 has an option for extrapolation

Sign in to comment.

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Asked:

J N
on 31 Jul 2018

Commented:

on 1 Aug 2018

Community Treasure Hunt

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

Start Hunting!