Cubic smoothing sline for trajectory approximation

7 次查看(过去 30 天)
How does it work the csaps function and its variations ?
I need simpler explanations and examples if it's what I need for approximation of multiple trajectories in order to get a single nominal one.
Thks

回答(1 个)

Raunak Gupta
Raunak Gupta 2019-10-3
Hi,
The Cubic Smoothing Sline is used for fitting a curve to the noisy data. As it is mentioned that there are multiple trajectories involved, I am assuming all represent the same path but with noise in each trajectory. Cubic Smoothing Spline will give a cubic polynomial between successive datapoints based on weightage given to error measure and roughness measure parameter.
I would suggest taking the mean of all datapoints across the trajectories so that only one trajectory remains. Then this trajectory’s path may be calculated with csaps. You may find the following minimum working example helpful.
% Lets assume we have 7 trajectories with 100 datapoints each.
% For example datapoints can be generated using randn
trajectories = randn(100,7);
% Taking mean across the trajectories (that is 2nd dimension) will give a single trajectory
trajectory = mean(trajectories,2);
p = 0.1; % define the error measure weightage (Give path matching closely with datapoint for high value of p)
% p must be between 0 and 1.
x_data = linspace(1,100,100); % Just to have 2D sense of trajectories
path = csaps(x_data,trajectory,p);
fnplt(path); % show the path
% Here path is a structure which contains the polynomial coefficient between each successive pair of datapoint.

类别

Help CenterFile Exchange 中查找有关 Splines 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by