Scattered interpolation with weight factors
조회 수: 17 (최근 30일)
이전 댓글 표시
Dear reader,
I am trying to interpolate scatter data as an input for my model. The input data is from different measurements and I would like to weight these measurements differently in my interpolation. The first measurement for instance I trust more and I would like to weight these points higher to focus the fit on this measurement. I use scatteredInterpolant often to fit measurement data, however, I have no idea how to introduce weight factors to this. I have looked into replicating the measurement data by repmat, however, if the weight factors become large this method is not prefered.
Do you have some tips for this application?
Kind regards,
Thijs
댓글 수: 2
답변 (1개)
Unai San Miguel
2019년 11월 22일
You could add some random points near the point you rely more on. Close enough to effect the interpolation and separated enough to avoid Matlab thinking they are the same point. For example (playwith scale and npoints)
% Points around [x1; y1; z1]
scale = 1e-2;
npoints = 100;
padd = randn([3, npoints]) * scale + [x1(1); y1(1); z1(1)];
figure(11)
clf
scatter3(x1, y1, z1, 'o')
hold on
scatter3(padd(1,:), padd(2,:),padd(3,:), 'k.')
G1 = scatteredInterpolant(x1.', y1.', z1.', 'linear', 'nearest');
G2 = scatteredInterpolant([x1, padd(1,:)].', [y1, padd(2,:)].', [z1, padd(3,:)].', 'linear', 'nearest');
hs1 = surf(X, Y, G1(X, Y), 'FaceAlpha', 0.5, 'FaceColor', 'r', 'EdgeColor', 'none');
hs2 = surf(X, Y, G2(X, Y), 'FaceAlpha', 0.5, 'FaceColor', 'b', 'EdgeColor', 'none');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!