MATLAB Answers

0

fit curves by smoothingspline

Asked by yizheng li on 14 Jun 2019
Latest activity Commented on by 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)

  0 Comments

Sign in to comment.

Tags

Products

1 Answer

Answer by Matt J
on 14 Jun 2019

Shouldn't this be,
plot(curve3,xx,Pattern3)

  2 Comments

untitled.pngthanks , I just notice thie typo. But even though I fix it, the first half of this graph still seems not fit well
You might have to experiment with the SmoothingParam input parameter, e.g.
f = fit(xx,Pattern3,'smoothingspline','SmoothingParam',0.07);

Sign in to comment.