interpolation
1 view (last 30 days)
Show older comments
hello I have two sets of data one is natural and the other is from experiment, the first is bigger than the second and more dense each data type have (t,x,y) how can I interpolate the data from the experiment using all of data vectors (t,x,y)? I want to calculate the error between the two thanks By the way i tried interp with no success I think I need to use amshgrid but I dont know ho to use it
0 Comments
Answers (3)
Aaditya Kalsi
on 1 Apr 2012
This is an easy one.
Let's say you have non-uniformly sampled data t, x, y. You want to find uniformly distributed values for these now.
I am assuming that t = f(x, y).
First we can define the the uniform grid we want the answers on. This usually would be like:
x = rand(100, 1);
y = rand(100, 1);
t = (x + y).^2;
% spacing
divUnit = 0.01;
xUnif = min(x) : divUnit : max(x);
yUnif = min(y) : divUnit : max(y);
% obtain the regural grid by MESHGRIDing the regularly spaced vectors
[X, Y] = meshgrid(xUnif, yUnif);
% interpolate 't' on this uniform grid
intObj = TriScatteredInterp(x, y, t);
T = intObj(X, Y);
% plot what we have
figure;
scatter3(x, y, t);
hold on;
surf(X, Y, T);
0 Comments
Aaditya Kalsi
on 1 Apr 2012
If you want to find the error between the two, you might be better of finding a model to predict this 'data' and then use Statistics to figure out how confidently your model fits each dataset. That would be the best way. The interpolation above may not be what you're looking for. For information on what Interpolation is performed here try:
0 Comments
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!