<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235449</link>
    <title>MATLAB Central Newsreader - data fitting / data analysis - spline?</title>
    <description>Feed for thread: data fitting / data analysis - spline?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 02 Sep 2008 20:20:17 -0400</pubDate>
      <title>data fitting / data analysis - spline?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235449#598415</link>
      <author>Mario </author>
      <description>Hi!&lt;br&gt;
I'm analyzing a list of x-y values,&lt;br&gt;
&lt;a href=&quot;http://www.geocities.com/mariopwr/data.png&quot;&gt;http://www.geocities.com/mariopwr/data.png&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://www.geocities.com/mariopwr/dataxy.zip&quot;&gt;http://www.geocities.com/mariopwr/dataxy.zip&lt;/a&gt; ,and i'm&lt;br&gt;
wondering if anybody can suggest me a good way to fit a&lt;br&gt;
curve on these points.&lt;br&gt;
I tried using the spline toolbox and I found a good (in my&lt;br&gt;
opinion) fit using the least square approximation with order&lt;br&gt;
14 (&lt;a href=&quot;http://www.geocities.com/mariopwr/spline.png).&quot;&gt;http://www.geocities.com/mariopwr/spline.png).&lt;/a&gt; Do you&lt;br&gt;
think it's a good approximation or should i try a different&lt;br&gt;
method?&lt;br&gt;
&lt;br&gt;
Anyway, after that i'd want to extract a few information&lt;br&gt;
from this graph like amplitude and width of each wave. Any&lt;br&gt;
suggestion?&lt;br&gt;
&lt;br&gt;
Thank you for your help! &lt;br&gt;
&lt;br&gt;
Mario</description>
    </item>
    <item>
      <pubDate>Thu, 04 Sep 2008 21:01:25 -0400</pubDate>
      <title>Re: data fitting / data analysis - spline?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235449#598761</link>
      <author>Miroslav Balda</author>
      <description>&quot;Mario &quot; &amp;lt;nospam@yahoo.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g9k761$d2h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
SNIP&lt;br&gt;
&lt;br&gt;
Hi Mario,&lt;br&gt;
&lt;br&gt;
Nobody answered yet, newertheless there is a solution in&lt;br&gt;
Fourier transform and a filtration in frequency domain. Test&lt;br&gt;
this code:&lt;br&gt;
&lt;br&gt;
load dataxy; % the downloaded data - signal&lt;br&gt;
x = xy(:,1);&lt;br&gt;
y = xy(:,2);&lt;br&gt;
m = length(x);&lt;br&gt;
A = [ones(m,1),x];&lt;br&gt;
c = A\y % coeffitients of best linear fit&lt;br&gt;
yc = y - A*c; % detrended signal&lt;br&gt;
Yc = fft(yc); % DFT of the signal&lt;br&gt;
n  = 20; % chosen number of low frequency components&lt;br&gt;
Yf = [Yc(1:n); zeros(m-2*n,1); Yc(end-n+1:end)];% filt. DFT&lt;br&gt;
yf = real(ifft(Yf)); % filtered signal&lt;br&gt;
yr = yf + A*c; % regressed y&lt;br&gt;
plot(x,y, x,yr,'r')&lt;br&gt;
grid&lt;br&gt;
&lt;br&gt;
The bigger is n the better approximation you get.&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Mira</description>
    </item>
    <item>
      <pubDate>Wed, 10 Sep 2008 02:12:02 -0400</pubDate>
      <title>Re: data fitting / data analysis - spline?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235449#599561</link>
      <author>Carlos Adrian Vargas Aguilera</author>
      <description>&quot;Miroslav Balda&quot; &amp;lt;miroslav.nospam@balda.cz&amp;gt; wrote in message &amp;lt;g9pib5$je2$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Mario &quot; &amp;lt;nospam@yahoo.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;g9k761$d2h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; SNIP&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi Mario,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Nobody answered yet, newertheless there is a solution in&lt;br&gt;
&amp;gt; Fourier transform and a filtration in frequency domain. Test&lt;br&gt;
&amp;gt; this code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; load dataxy; % the downloaded data - signal&lt;br&gt;
&amp;gt; x = xy(:,1);&lt;br&gt;
&amp;gt; y = xy(:,2);&lt;br&gt;
&amp;gt; m = length(x);&lt;br&gt;
&amp;gt; A = [ones(m,1),x];&lt;br&gt;
&amp;gt; c = A\y % coeffitients of best linear fit&lt;br&gt;
&amp;gt; yc = y - A*c; % detrended signal&lt;br&gt;
&amp;gt; Yc = fft(yc); % DFT of the signal&lt;br&gt;
&amp;gt; n  = 20; % chosen number of low frequency components&lt;br&gt;
&amp;gt; Yf = [Yc(1:n); zeros(m-2*n,1); Yc(end-n+1:end)];% filt. DFT&lt;br&gt;
&amp;gt; yf = real(ifft(Yf)); % filtered signal&lt;br&gt;
&amp;gt; yr = yf + A*c; % regressed y&lt;br&gt;
&amp;gt; plot(x,y, x,yr,'r')&lt;br&gt;
&amp;gt; grid&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The bigger is n the better approximation you get.&lt;br&gt;
&amp;gt; Hope this helps.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Mira&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
Take a look to WINSINC here at the FileExchange:&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8574&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8574&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Carlos Vargas</description>
    </item>
    <item>
      <pubDate>Fri, 19 Sep 2008 19:33:02 -0400</pubDate>
      <title>Re: data fitting / data analysis - spline?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235449#601117</link>
      <author>Mario </author>
      <description>so what do you guys suggest to filter my data in the best way?&lt;br&gt;
I'd like to keep the peaks at approximately 5-15-35-50-70-85 an so on (in picture &lt;a href=&quot;http://www.geocities.com/mariopwr/data.png&quot;&gt;http://www.geocities.com/mariopwr/data.png&lt;/a&gt; ) and then fit a spline on the filtered signal.&lt;br&gt;
&lt;br&gt;
Thank you for your help!&lt;br&gt;
Regards,&lt;br&gt;
&lt;br&gt;
Mario</description>
    </item>
    <item>
      <pubDate>Tue, 23 Sep 2008 09:19:57 -0400</pubDate>
      <title>Re: data fitting / data analysis - spline?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235449#601578</link>
      <author>rych</author>
      <description>On Sep 10, 3:12 am, &quot;Carlos Adrian Vargas Aguilera&quot;&lt;br&gt;
&amp;lt;nubeobsc...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; load dataxy; % the downloaded data - signal&lt;br&gt;
&amp;gt; &amp;gt; x = xy(:,1);&lt;br&gt;
&amp;gt; &amp;gt; y = xy(:,2);&lt;br&gt;
&amp;gt; &amp;gt; m = length(x);&lt;br&gt;
&amp;gt; &amp;gt; A = [ones(m,1),x];&lt;br&gt;
&amp;gt; &amp;gt; c = A\y % coeffitients of best linear fit&lt;br&gt;
&amp;gt; &amp;gt; yc = y - A*c; % detrended signal&lt;br&gt;
&amp;gt; &amp;gt; Yc = fft(yc); % DFT of the signal&lt;br&gt;
&amp;gt; &amp;gt; n  = 20; % chosen number of low frequency components&lt;br&gt;
&amp;gt; &amp;gt; Yf = [Yc(1:n); zeros(m-2*n,1); Yc(end-n+1:end)];% filt. DFT&lt;br&gt;
&amp;gt; &amp;gt; yf = real(ifft(Yf)); % filtered signal&lt;br&gt;
&amp;gt; &amp;gt; yr = yf + A*c; % regressed y&lt;br&gt;
&amp;gt; &amp;gt; plot(x,y, x,yr,'r')&lt;br&gt;
&amp;gt; &amp;gt; grid&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Take a look to WINSINC here at the FileExchange:&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objec...&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objec...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Carlos,&lt;br&gt;
Could you elaborate a little more on how to do the same &quot;detrending&quot;&lt;br&gt;
using winsinc and why it is better?&lt;br&gt;
Igor</description>
    </item>
  </channel>
</rss>

