Neither am I an expert. Your plot solution looks
suspicious to me because the endpoints of each graph
"diverge" in the sense that for example the blue line is
arcing upward on both ends.

        I found a promising reference at
http://en.wikipedia.org/wiki/Trigonometric_interpolation but
am unable to implement it with my lack of math skills,
especially because it mentions Discrete Fourier Transforms
(DFT) and because I don't understand how to use its advise
for adapting to an even number of sample points.

        Btw, in an offline message, I was told that a typo
produced only 11 data points when there should be the
following 12, which I used to produce your plots.

tave=: _7.3 _6.6 _1.8 3.6 11.1 17.1 19.8 17.1 11.3  4.7 _1.3 _5.0

On Fri, 8 Jun 2007, Raul Miller wrote:

+ On 6/8/07, Anssi Seppälä <[EMAIL PROTECTED]> wrote:
+ > Dear J folks,
+ > I have a problem: I have monthly average temperatures and I need
+ > interpolate daily values and I like to have a beautiful cyclic curve
+ > fitting and resulting almiost the same monthly averages. It is
+ > allowed to assume that all months are 30 days.
+ >
+ > The monthly averages are in Centrigrades: tave=:_7.3 _6.6 _1.8 3.6
+ > 11.1 17.1 19.8 11.3  4.7 _1.3 _5.0
+
+ There's all kinds of curve fitting.
+
+ For example, here's a fairly trivial fit that might or might not be
+ close to what you are looking for:
+
+ extend=: +/ .*&2 _1@(2&{.) , ] , +/ .*&_1 2@(_2&{.)
+ zero=: {. -:@+ {:
+ ct=: 2 o. 1r29p1*i.30
+ fit=: 15 }. _15 }. [: , 2&((zero + ct * zero - {:)\)@extend
+
+ Here's a somewhat different approach, emphasizing appearance:
+
+ arbitraryConstant=:300
+ curve=:3 :0
+   rough=.30#y
+   basis=.^((*-)  -/~ i.#rough)%arbitraryConstant
+   shape=.basis +/ .*basis%.rough
+   max=.(i.>./)|shape
+   shape*rough%&(max&{)shape
+ )
+
+ Contrast:
+    plot (curve tave),(fit tave),:30#tave
+
+ (As an aside, I'm no expert on curve fitting issues.)
+
+ --
+ Raul
+ ----------------------------------------------------------------------
+ For information about J forums see http://www.jsoftware.com/forums.htm
+

(B=) <----------my "sig"

Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to