Gridding and interpolate data
Show older comments
Dear friends,
I have a lot of data and i need to interpolate and grid the data..I plan to use krigging method to grid the data.but my problem, the data are not uniform..Can someone suggest to me or example matlab program to solve my problem.
Thanks
1 Comment
Taindra Neupane
on 1 Oct 2020
Hello Friends,
I have a 2d uniformly gridded data (like an image or dose with specific voxel size), I am looking for interpolation funtion to divide into +ve interger as well as non-integer values like 1, 1.5,2....! I am using interpn (A,k) or interpn2 (A,k) but its interpolating only into even +ve intergers points/values like k=0, no interpolation, k=1, two values, k=2, 4 values as it divide into 2^k -1 values. So, I am wondering if I want to divide 3mmx3mm pixel into 1mmx1mm pixel (3 sections). Please help me on this.
Thanks in advance!
Accepted Answer
More Answers (4)
joo tan
on 8 Oct 2011
0 votes
1 Comment
The program needs five input arguments. The first three represent the non-uniform points that you know, the last two represent the uniform x, y grid you want to interpolate to. Let's say you have x data with range 300 to 400 and y data with range 600 to 950. Then you would construct the last two input arguments for the program by running, say:
dx = 0.5;
dy = 1;
[XI, YI] = meshgrid(300:dx:400, 600:dy:950);
Then run the program:
HI = biharmonic_spline_interp2(x,y,h,XI,YI);
HI will be a matrix similar to what you would get out of "interp2" program.
joo tan
on 9 Oct 2011
0 votes
1 Comment
This program isn't really meant for plotting on a spherical surface, unless you are looking at a small enough region. 1. Your latitude range would be from min(Latitude) to max(Latitude) and your longitude range would be from min(Longitude) to max(Longitude). 2. If you want to create a latitude grid increment (dLat) and a longitude grid increment (dLon), then you decide how many grid points you want. If you want to divide your Latitude into 101 points and your Longitude into 201 points, then you would:
dLon = (max(Longitude)-min(Longitude))/200;
dLat = (max(Latitude)-min(Latitude))/100;
[XI, YI] = meshgrid(min(Longitude):dLon:max(Longitude) , min(Latitude):dLat:max(Latitude));
Neil
on 13 Aug 2014
Thanks for the implementation of the Sandwell algorithm. Is there a way to adapt this implementation to get it to work on larger sets of input data? I have a 600x600 pixel image, with many holes in it, and I tried to fill in the holes using biharmonic spline interpolation. However the part of the code where it uses
gg = zeros(length(Z),length(Z));
blows up because length(Z) is 124504 (in the example it's 100). I could break up the image into smaller parts and process each individually but I'm not sure what would happen at the boundaries when I put the reconstructed sub-images back together.
I would appreciate your feedback.
Best regards,
Neil
2 Comments
John D'Errico
on 26 Dec 2014
I would point out that you got no response, because you added an ANSWER! How can you possibly expect that someone will know that you had a question and not a real answer?
In the future, if you have a question, then ask it, as a question.
Neil
on 26 Dec 2014
You're right, John. I was trying to ask a question by commenting on E. Grant's original answer, but used the wrong link. (I think I did that correctly last night when I asked another question about biharmonic_spline_interp2.)
For what it's worth, since I asked this question, I've realized that biharmonic spline interpolation is not the best approach for fitting a surface to a very large number of data, unless one would like to incorporate slope data, which I don't; also, when there are error bars, forcing the fit to exactly reproduce the data is not a good idea. (It makes more sense to use something like gridfit in that case.) But I'm curious to know why biharmonic_spline_interp2 behaves differently from MATLAB's own cftool when Model='biharmonicinterp' or griddata when Method='v4'.
Neil
Christopher Gordon
on 19 Feb 2021
0 votes
Good afternoon!
It seems as though you can't run this function unless all the initial dimensions (X,Y,Z) are equal. I have a 2D matrix of spectra, (30 spectra, each being 1024 data points long) and I'm trying to interpolate it to be a 1024 x 1024 matrix. Is there a way to do that with this, or do I have to use another approach entirely?
Categories
Find more on Spline Postprocessing 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!