interpolation
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (3개)
Aaditya Kalsi
2012년 4월 1일
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
Aaditya Kalsi
2012년 4월 1일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!