Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!z66g2000hsc.googlegroups.com!not-for-mail
From: rych <rychphd@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: data fitting / data analysis - spline?
Date: Tue, 23 Sep 2008 02:19:57 -0700 (PDT)
Organization: http://groups.google.com
Lines: 27
Message-ID: <69d999c6-3562-4d69-8335-9c5e1fbe009f@z66g2000hsc.googlegroups.com>
References: <g9k761$d2h$1@fred.mathworks.com> <g9pib5$je2$1@fred.mathworks.com> 
	<ga7adi$g1f$1@fred.mathworks.com>
NNTP-Posting-Host: 144.124.16.33
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1222161598 32028 127.0.0.1 (23 Sep 2008 09:19:58 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 23 Sep 2008 09:19:58 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: z66g2000hsc.googlegroups.com; posting-host=144.124.16.33; 
	posting-account=q0YHcwoAAADbDc1UOEbilYdUiU-iCJDX
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) 
	Gecko/2008070208 Firefox/3.0.1,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 towy.aber.ac.uk:8082 (squid/2.7.STABLE3)
Xref: news.mathworks.com comp.soft-sys.matlab:491491


On Sep 10, 3:12 am, "Carlos Adrian Vargas Aguilera"
<nubeobsc...@hotmail.com> wrote:
>
> > load dataxy; % the downloaded data - signal
> > x = xy(:,1);
> > y = xy(:,2);
> > m = length(x);
> > A = [ones(m,1),x];
> > c = A\y % coeffitients of best linear fit
> > yc = y - A*c; % detrended signal
> > Yc = fft(yc); % DFT of the signal
> > n  = 20; % chosen number of low frequency components
> > Yf = [Yc(1:n); zeros(m-2*n,1); Yc(end-n+1:end)];% filt. DFT
> > yf = real(ifft(Yf)); % filtered signal
> > yr = yf + A*c; % regressed y
> > plot(x,y, x,yr,'r')
> > grid
>
> This is an ideal filter, but is the worst way to do a filtering. You are applying a weighting/multiplication rectangular window in frequency domain, which is a smoothing/convolution SINC window in the time domain with huge sidelobes and Gibb's phenomena.
>
> Take a look to WINSINC here at the FileExchange:http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objec...


Carlos,
Could you elaborate a little more on how to do the same "detrending"
using winsinc and why it is better?
Igor