fit curves by smoothingspline

2 views (last 30 days)
yizheng li
yizheng li on 14 Jun 2019
Commented: Matt J on 14 Jun 2019
I have a sets of data, and I want to plot them in dot then fit them with curve, but the fitted curve doesnt seems fit very well(the curve is so far away from realy point. I'm using the code below for fit, did I make some mistake?
clear all
load positiontest.mat
xx;
Pattern3;
curve3 = fit(xx,Pattern3,'smoothingspline');
figure,
plot(curve3,xx,Pattern2)

Answers (1)

Matt J
Matt J on 14 Jun 2019
Shouldn't this be,
plot(curve3,xx,Pattern3)
  2 Comments
yizheng li
yizheng li on 14 Jun 2019
untitled.pngthanks , I just notice thie typo. But even though I fix it, the first half of this graph still seems not fit well
Matt J
Matt J on 14 Jun 2019
You might have to experiment with the SmoothingParam input parameter, e.g.
f = fit(xx,Pattern3,'smoothingspline','SmoothingParam',0.07);

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!