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!