Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Spline, Interpolation
Date: Mon, 10 Nov 2008 23:03:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <gfaej6$kro$1@fred.mathworks.com>
References: <gfadn3$7os$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1226358182 21368 172.30.248.37 (10 Nov 2008 23:03:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 10 Nov 2008 23:03:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:500107


"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.