Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Spline, Interpolation

Subject: Spline, Interpolation

From: Masoud

Date: 10 Nov, 2008 22:48:03

Message: 1 of 2

Hey guys

I have a problem with spline function,
I have to smooth my data but the spline functions change the start and end point of my data (and It's not what I want)
They change the order of my data too
Could you please guide me?

Subject: Spline, Interpolation

From: Dave Brackett

Date: 10 Nov, 2008 23:03:02

Message: 2 of 2

"Masoud " <smn6@sfu.ca> wrote in message <gfadn3$7os$1@fred.mathworks.com>...
> Hey guys
>
> I have a problem with spline function,
> I have to smooth my data but the spline functions change the start and end point of my data (and It's not what I want)
> They change the order of my data too
> Could you please guide me?


I recently had to deal with this problem and sorted it by weighting the data points the spline is fitting to. If you weight the start and end points much higher than the points inbetween it will take the spline closer to the start and end points. It will not usually go through them exactly but will get close and this depends on the relative weightings.

For instance, I used a weighting of 1 for the start and end points, and 0.005 for the inner points.

Use the curve fitting tool (cftool) and it makes this quite straightforward. You can then generate the m code from this once you have tweaked the settings.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us