title: Create Envelope with Spline Interpolation in R
body: <p>Hello I have tried spline interpolation in Matlab. I have the following data:</p>
  
  <pre><code>N = 36
  </code></pre>
  
  <p>I also have data "max"</p>
  
  <pre><code>&gt;  max
      1
      5
      7
      10
      12
      14
      16
      20
      24
      27
      31
      33
      35
  </code></pre>
  
  <p>And "hmax"</p>
  
  <pre><code>&gt;  hmax
      157
      124
      207
      208
      170
      178
      163
      160
      146
      151
      160
      173
      172
  </code></pre>
  
  <p>Then I want to create envelope with spline interpolation with Matlab, the following code:</p>
  
  <pre><code>maxenv = spline(max,hmax,1:N);
  </code></pre>
  
  <p>That code will show result</p>
  
  <pre><code>&gt;  maxenv
      157
      86.564389
      67.53534827
      84.9886334
      124
      169.6452037
      207
      224.3964594
      223.1919113
      208
      185.4207867
      170
      172.1744995
      178
      172.7562154
      163
      158.1641553
      157.9081319
      159.4480425
      160
      157.5512022
      153.1731874
      148.7085789
      146
      146.3035305
      148.5290764
      151
      152.5114649
      153.7458399
      155.857295
      160
      166.578645
      173
      175.921355
      172
      157.893225
  </code></pre>
  
  <p>Now, I want create envelope with spline interpolation in R with same code:</p>
  
  <pre><code>maxenv &lt;- spline(max,hmax,n=36)
  </code></pre>
  
  <p>But I get different result with my code in Matlab. How can I get the same result in R? Or "spline" on Matlab and R is different function?</p>
  
  <p>Thanks you very much</p>