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 个评论

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

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Interpolation 的更多信息

提问:

J N
2018-7-31

评论:

2018-8-1

Community Treasure Hunt

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

Start Hunting!

Translated by