<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613</link>
    <title>MATLAB Central Newsreader - interpolate</title>
    <description>Feed for thread: interpolate</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>Fri, 01 Aug 2008 10:59:03 -0400</pubDate>
      <title>interpolate</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613#446696</link>
      <author>Dave Brackett</author>
      <description>I have 12 data points at the following coordinates:&lt;br&gt;
&lt;br&gt;
x:      y:&lt;br&gt;
78	6.00E+07&lt;br&gt;
233	6.00E+07&lt;br&gt;
349	6.00E+07&lt;br&gt;
466	6.00E+07&lt;br&gt;
587	6.00E+07&lt;br&gt;
699	6.00E+07&lt;br&gt;
807	4.00E+07&lt;br&gt;
932	3.00E+07&lt;br&gt;
1047	2.00E+07&lt;br&gt;
1175	1.00E+07&lt;br&gt;
1281	1.00E+07&lt;br&gt;
1397	5.00E+06&lt;br&gt;
&lt;br&gt;
At the midpoint between each point y is 0 (not listed&lt;br&gt;
above). I want to interpolate using an exponential function&lt;br&gt;
between the y values thereby creating peaks. A picture of&lt;br&gt;
the kind of thing I want the results to be can be found&lt;br&gt;
here:&lt;br&gt;
&lt;a href=&quot;http://upload2.net/page/download/m8KAixt8aZdvCTp/example+of+peaks.pdf.html&quot;&gt;http://upload2.net/page/download/m8KAixt8aZdvCTp/example+of+peaks.pdf.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Thanks.</description>
    </item>
    <item>
      <pubDate>Fri, 01 Aug 2008 13:26:01 -0400</pubDate>
      <title>Re: interpolate</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613#446733</link>
      <author>John D'Errico</author>
      <description>&quot;Dave Brackett&quot; &amp;lt;davebrackett@hotmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g6uq9n$b2p$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have 12 data points at the following coordinates:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; x:      y:&lt;br&gt;
&amp;gt; 78	6.00E+07&lt;br&gt;
&amp;gt; 233	6.00E+07&lt;br&gt;
&amp;gt; 349	6.00E+07&lt;br&gt;
&amp;gt; 466	6.00E+07&lt;br&gt;
&amp;gt; 587	6.00E+07&lt;br&gt;
&amp;gt; 699	6.00E+07&lt;br&gt;
&amp;gt; 807	4.00E+07&lt;br&gt;
&amp;gt; 932	3.00E+07&lt;br&gt;
&amp;gt; 1047	2.00E+07&lt;br&gt;
&amp;gt; 1175	1.00E+07&lt;br&gt;
&amp;gt; 1281	1.00E+07&lt;br&gt;
&amp;gt; 1397	5.00E+06&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; At the midpoint between each point y is 0 (not listed&lt;br&gt;
&amp;gt; above). I want to interpolate using an exponential function&lt;br&gt;
&amp;gt; between the y values thereby creating peaks. A picture of&lt;br&gt;
&amp;gt; the kind of thing I want the results to be can be found&lt;br&gt;
&amp;gt; here:&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;a href=&quot;http://upload2.net/page/download/m8KAixt8aZdvCTp/example+of+peaks.p&quot;&gt;http://upload2.net/page/download/m8KAixt8aZdvCTp/example+of+peaks.p&lt;/a&gt;&lt;br&gt;
df.html&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks.&lt;br&gt;
&lt;br&gt;
You might find a better way to provide your&lt;br&gt;
example than that service. I refuse to answer&lt;br&gt;
the questions it wants me to respond to, just&lt;br&gt;
to look at your picture.&lt;br&gt;
&lt;br&gt;
And please explain yourself more clearly,&lt;br&gt;
although if you did explain more clearly, you&lt;br&gt;
probably would solve your own question. What&lt;br&gt;
exponential function will you use? Do you want&lt;br&gt;
the interpolant to go through zero between&lt;br&gt;
every pair of data points?&lt;br&gt;
&lt;br&gt;
Why in gods name do you want to interpolate&lt;br&gt;
in this way anyway?&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Fri, 01 Aug 2008 16:14:02 -0400</pubDate>
      <title>Re: interpolate</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613#446790</link>
      <author>Dave Brackett</author>
      <description>&amp;gt; You might find a better way to provide your&lt;br&gt;
&amp;gt; example than that service. I refuse to answer&lt;br&gt;
&amp;gt; the questions it wants me to respond to, just&lt;br&gt;
&amp;gt; to look at your picture.&lt;br&gt;
&lt;br&gt;
sorry about that - it didn't bug me with questions when I &lt;br&gt;
tested it. try this: &lt;br&gt;
&lt;a href=&quot;http://www.filedropper.com/exampleofpeaks&quot;&gt;http://www.filedropper.com/exampleofpeaks&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&amp;gt; And please explain yourself more clearly,&lt;br&gt;
&amp;gt; although if you did explain more clearly, you&lt;br&gt;
&amp;gt; probably would solve your own question. What&lt;br&gt;
&amp;gt; exponential function will you use? Do you want&lt;br&gt;
&amp;gt; the interpolant to go through zero between&lt;br&gt;
&amp;gt; every pair of data points?&lt;br&gt;
&lt;br&gt;
Hopefully when you see the picture it will make more sense. &lt;br&gt;
I'm not sure which exponential function to use but I &lt;br&gt;
imagine it will be a simple job to replace functions once &lt;br&gt;
the method is worked out, so choose a common one to start &lt;br&gt;
with. &lt;br&gt;
&lt;br&gt;
I am only specifying the peak coordinates and that the y &lt;br&gt;
coord is 0 between each peak. I want to generate the data &lt;br&gt;
points between each peak and 0 to get something similar to &lt;br&gt;
the plot in the picture. &lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; Why in gods name do you want to interpolate&lt;br&gt;
&amp;gt; in this way anyway?&lt;br&gt;
&lt;br&gt;
To generate the plot shown in the picture. hope that makes &lt;br&gt;
a bit more sense. i look forward to hearing from you again.&lt;br&gt;
thanks.</description>
    </item>
    <item>
      <pubDate>Fri, 01 Aug 2008 19:05:49 -0400</pubDate>
      <title>Re: interpolate</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613#446831</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;g6uq9n$b2p$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
Dave Brackett &amp;lt;davebrackett@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;I have 12 data points at the following coordinates:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;x:      y:&lt;br&gt;
&amp;gt;78	6.00E+07&lt;br&gt;
&amp;gt;233	6.00E+07&lt;br&gt;
&amp;gt;349	6.00E+07&lt;br&gt;
&amp;gt;466	6.00E+07&lt;br&gt;
&amp;gt;587	6.00E+07&lt;br&gt;
&amp;gt;699	6.00E+07&lt;br&gt;
&amp;gt;807	4.00E+07&lt;br&gt;
&amp;gt;932	3.00E+07&lt;br&gt;
&amp;gt;1047	2.00E+07&lt;br&gt;
&amp;gt;1175	1.00E+07&lt;br&gt;
&amp;gt;1281	1.00E+07&lt;br&gt;
&amp;gt;1397	5.00E+06&lt;br&gt;
&lt;br&gt;
&amp;gt;At the midpoint between each point y is 0 (not listed&lt;br&gt;
&amp;gt;above). I want to interpolate using an exponential function&lt;br&gt;
&amp;gt;between the y values thereby creating peaks.&lt;br&gt;
&lt;br&gt;
Start from an x location that has a y of 0 (e.g., half way&lt;br&gt;
between adjacent x.) Call it H (for &quot;here&quot;). Take the distance&lt;br&gt;
between where you are (H) and the next peak (call it T, for &quot;there&quot;).&lt;br&gt;
In that distance, you have to rise from 0 to the value of that next peak.&lt;br&gt;
You wish to use an exponential function, so you will be using exp(c*(t-H))&lt;br&gt;
where t is the position being interpolated, and for some constant c&lt;br&gt;
that depends upon the height you are rising to. However,&lt;br&gt;
that function can never go negative, and at t == H would have a value of 1.&lt;br&gt;
The easiest solution is to use (exp(c*(t-H)) - 1) .&lt;br&gt;
&lt;br&gt;
Now you have to figure out the constant c. Keeping in mind the -1&lt;br&gt;
in the equation, you need to rise from 1 to a height of y+1 over a&lt;br&gt;
distance of T-H . So y+1 = exp(c*(T-H)). Take the log of both sides.&lt;br&gt;
log(y+1) = c*(T-H) . Divide through by T-H to get&lt;br&gt;
c = log(y+1) / (T-H) . Now you know that from t=H to t=T, the&lt;br&gt;
equation is (exp(log(y+1) / (T-H) * (t-H)) - 1).&lt;br&gt;
&lt;br&gt;
You can use very similar logic to figure out how to fall from&lt;br&gt;
a given height to 0 over a particular distance.&lt;br&gt;
&lt;br&gt;
Now your only issues are how to handle the endpoints. You haven't&lt;br&gt;
included any information that would allow us to figure out&lt;br&gt;
the initial point at the left at which the y value should be 0,&lt;br&gt;
nor the terminal point at the right at which the y value should be 0.&lt;br&gt;
&lt;br&gt;
If it happened that for the purposes of the problem the peaks&lt;br&gt;
had to be symmetric, then we could calculate the starting and ending&lt;br&gt;
points (but determining the 0 point between peaks would be more&lt;br&gt;
complex.) You gave no indication that the peaks should be&lt;br&gt;
symmetrical -- instead you indicated that you wanted to use&lt;br&gt;
interpolation, which is a term that implies &quot;approximation&quot; and&lt;br&gt;
has no inherent implication of symmetry. For example you might have&lt;br&gt;
been thinking of using a spline fit (somehow or other!) to&lt;br&gt;
determine the data values. When you have an equation family&lt;br&gt;
that gives an exact shape (e.g., &quot;exponential&quot;) then the term&lt;br&gt;
that is used for the intermediate values is &quot;calculate&quot;, not&lt;br&gt;
&quot;interpolate&quot;. On the basis of the information we were given,&lt;br&gt;
a non-symmetric peak model is at least as valid an interpolation as&lt;br&gt;
any other.&lt;br&gt;
&lt;br&gt;
The calculation I show above to determine the center positions&lt;br&gt;
and the constants for the exponentials can be vectorized without&lt;br&gt;
much difficulty.&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&quot;And believe me, I was very lousy yesterday.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;I had nothing to say, and, by God, I said it.&quot;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Walter Wellesley Smith</description>
    </item>
    <item>
      <pubDate>Fri, 01 Aug 2008 23:20:03 -0400</pubDate>
      <title>Re: interpolate</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613#446873</link>
      <author>John D'Errico</author>
      <description>&quot;Dave Brackett&quot; &amp;lt;davebrackett@hotmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g6vcoa$peq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; You might find a better way to provide your&lt;br&gt;
&amp;gt; &amp;gt; example than that service. I refuse to answer&lt;br&gt;
&amp;gt; &amp;gt; the questions it wants me to respond to, just&lt;br&gt;
&amp;gt; &amp;gt; to look at your picture.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; sorry about that - it didn't bug me with questions when I &lt;br&gt;
&amp;gt; tested it. try this: &lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.filedropper.com/exampleofpeaks&quot;&gt;http://www.filedropper.com/exampleofpeaks&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
That one works.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; &amp;gt; And please explain yourself more clearly,&lt;br&gt;
&amp;gt; &amp;gt; although if you did explain more clearly, you&lt;br&gt;
&amp;gt; &amp;gt; probably would solve your own question. What&lt;br&gt;
&amp;gt; &amp;gt; exponential function will you use? Do you want&lt;br&gt;
&amp;gt; &amp;gt; the interpolant to go through zero between&lt;br&gt;
&amp;gt; &amp;gt; every pair of data points?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hopefully when you see the picture it will make more sense. &lt;br&gt;
&amp;gt; I'm not sure which exponential function to use but I &lt;br&gt;
&amp;gt; imagine it will be a simple job to replace functions once &lt;br&gt;
&amp;gt; the method is worked out, so choose a common one to start &lt;br&gt;
&amp;gt; with. &lt;br&gt;
&lt;br&gt;
You have not defined the desired&lt;br&gt;
characteristics of the interpolant. In&lt;br&gt;
fact, the curve in the figure does NOT&lt;br&gt;
pass through zero in the middle of&lt;br&gt;
each segment.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; I am only specifying the peak coordinates and that the y &lt;br&gt;
&amp;gt; coord is 0 between each peak. I want to generate the data &lt;br&gt;
&amp;gt; points between each peak and 0 to get something similar to &lt;br&gt;
&amp;gt; the plot in the picture. &lt;br&gt;
&lt;br&gt;
Again, the picture you uploaded does&lt;br&gt;
not actually pass through zero.&lt;br&gt;
&lt;br&gt;
So, what property do you want to see?&lt;br&gt;
&lt;br&gt;
A true zero? Or something else?&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Sat, 02 Aug 2008 00:23:03 -0400</pubDate>
      <title>Re: interpolate</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613#446878</link>
      <author>John D'Errico</author>
      <description>&quot;Dave Brackett&quot; &amp;lt;davebrackett@hotmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g6vcoa$peq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; I am only specifying the peak coordinates and that the y &lt;br&gt;
&amp;gt; coord is 0 between each peak. I want to generate the data &lt;br&gt;
&amp;gt; points between each peak and 0 to get something similar to &lt;br&gt;
&amp;gt; the plot in the picture. &lt;br&gt;
&lt;br&gt;
I'll show some mercy. Assuming that you&lt;br&gt;
don't really want to get 0 in between...&lt;br&gt;
&lt;br&gt;
k = .1;&lt;br&gt;
coef = exp(-abs(bsxfun(@minus,x,x')*k))\y;&lt;br&gt;
xev = 0:1500;&lt;br&gt;
pred = exp(-abs(bsxfun(@minus,xev',x')*k))*coef;&lt;br&gt;
plot(xev,pred)&lt;br&gt;
&lt;br&gt;
You can pick the value of k that gives you&lt;br&gt;
the shape you want to see. I still don't see&lt;br&gt;
why you want it, but thats your problem.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Wed, 13 Aug 2008 13:06:02 -0400</pubDate>
      <title>Re: interpolate</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173613#448889</link>
      <author>Dave Brackett</author>
      <description>&quot;John D'Errico&quot; &amp;lt;woodchips@rochester.rr.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;g709d7$eq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Dave Brackett&quot; &amp;lt;davebrackett@hotmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;g6vcoa$peq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I am only specifying the peak coordinates and that the y &lt;br&gt;
&amp;gt; &amp;gt; coord is 0 between each peak. I want to generate the data &lt;br&gt;
&amp;gt; &amp;gt; points between each peak and 0 to get something similar to &lt;br&gt;
&amp;gt; &amp;gt; the plot in the picture. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I'll show some mercy. Assuming that you&lt;br&gt;
&amp;gt; don't really want to get 0 in between...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; k = .1;&lt;br&gt;
&amp;gt; coef = exp(-abs(bsxfun(@minus,x,x')*k))\y;&lt;br&gt;
&amp;gt; xev = 0:1500;&lt;br&gt;
&amp;gt; pred = exp(-abs(bsxfun(@minus,xev',x')*k))*coef;&lt;br&gt;
&amp;gt; plot(xev,pred)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You can pick the value of k that gives you&lt;br&gt;
&amp;gt; the shape you want to see. I still don't see&lt;br&gt;
&amp;gt; why you want it, but thats your problem.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; John&lt;br&gt;
&lt;br&gt;
Indeed the plot in the picture does not go exactly to zero,&lt;br&gt;
but as I said in the first post, the picture shows the 'kind&lt;br&gt;
of thing' I want. It is actually unimportant in this case&lt;br&gt;
whether it completely reaches zero or not. It just needs to&lt;br&gt;
get close.&lt;br&gt;
&lt;br&gt;
Thank you both for your help with this, I can achieve what I&lt;br&gt;
need now.</description>
    </item>
  </channel>
</rss>

