Extrapolating from matrix data

3 views (last 30 days)
Steve
Steve on 4 Mar 2019
Commented: Steven Lord on 5 Mar 2019
I have a matrix that is 152 x 152:
Is there a way to extrapolte this matrix to 500 x 500 without getting the x-y-z data from it first?
Thanks,
Steve
  2 Comments
John D'Errico
John D'Errico on 4 Mar 2019
Yes. But you might be foolish to extrapolate that far out. I'm not saying that people never do foolish things, but why add your name to the list? ;-)
My favorite quote about extrapolation cames from Mark Twain himself, in Life on the Mississippi (1884).
"In the space of one hundred and seventy six years the Lower Mississippi has shortened itself two hundred and forty-two miles. That is an average of a trifle over a mile and a third per year. Therefore, any calm person, who is not blind or idiotic, can see that in the Old Oölitic Silurian Period, just a million years ago next November, the Lower Mississippi was upwards of one million three hundred thousand miles long, and stuck out over the Gulf of Mexico like a fishing-pole. And by the same token any person can see that seven hundred and forty-two years from now the Lower Mississippi will be only a mile and three-quarters long, and Cairo [Illinois] and New Orleans will have joined their streets together and be plodding comfortably along under a single mayor and a mutual board of aldermen. There is something fascinating about science. One gets such wholesale returns of conjecture out of such a trifling investment of fact."
John D'Errico
John D'Errico on 5 Mar 2019
Edited: John D'Errico on 5 Mar 2019
@Steve: Please don't add an answer just to make a comment. Moved to a comment:
"Thanks for the diatribe.
I understand my application and the pitfalls associated with extrapolation.
Do you have an answer?
Thanks,
Steve"

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 5 Mar 2019
Sigh. Hint:
help interp2
help griddedInterpolant
Note that both allow you to extrapolate. I'm not sure what "getting the xyz data from it" means. You can't use a call to meshgrid to create x and y?
  2 Comments
Steve
Steve on 5 Mar 2019
Thanks John,
I looked at those functions previously and thought that they needed X,Y vectors with z values. For example, I usually use griddata like this:
Shift=griddata(x,y,z,xi,yi,'v4') to extrapolate out to a larger grid than contained in the data and it works great.
The issue that I'm having now is that my surface contains >50,000 XY pairs and griddata with the 'v4' argument fails for running out of memory. I can use 'nearest' but I don't like the solution that it resolves to.
So what I want to do (if it's possible) is to find a function that takes a matrix as an input and expands it out into a meshgrid or other of a larger size than the matrix, with something other than 'linear', and prefereably a nice spline like v4 offers.
Steve
Steven Lord
Steven Lord on 5 Mar 2019
When you say ">50,000 XY pairs", are they on a grid (230-by-230 or thereabouts?) or are they scattered? If they're scattered, take a look at scatteredInterpolant.

Sign in to comment.

Categories

Find more on Resizing and Reshaping Matrices 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!