# Spline interpolation introduces negative values I have a number of waves, strictly positive, of 2049 points. I do an interpolation down to 100 points:

Interpolate2/T=3/N=100/I=2/F=0/Y=spec_VT095_n_SS/X=freq_VT095_SS freq_VT095, spec_VT095_n

(spec=spectrum, freq=frequency).

The interpolation introduces some negative values in the new wave. What is the reason for this, and how can I overcome it?

A test experiment is attached.
The cubic spline, and the smoothing spline, fit a local cubic polynomial to sets of contiguous points. What you see is the result of those fits. There is no reason for the output values to be non-negative - they just need to satisfy the cubic polynomial equation which is different for each set of points.

Since your data has an abrupt change over few points at the beginning, you get what you see.

Smoothing spline interpolation has no analytical value - it is just to produce a smooth curve for visual effect. It works best noisy but reasonably smooth input.

If you set the first point to NaN and then redo the smoothing spline, you get better results because you have removed the discontinuity from the input:

Variable saveFirstPoint = spec_VT095_n
spec_VT095_n = NaN
Interpolate2/T=3/N=100/I=2/F=0/Y=spec_VT095_n_SS/X=freq_VT095_SS freq_VT095, spec_VT095_n
spec_VT095_n = saveFirstPoint

Here is a recreation macro for the graph I used to examine the data:
Window Graph0() : Graph
PauseUpdate; Silent 1       // building window...
Display /W=(12,51,1038,674) spec_VT095_n vs freq_VT095
AppendToGraph spec_VT095_n_SS vs freq_VT095_SS
ModifyGraph mode(spec_VT095_n)=3
ModifyGraph marker(spec_VT095_n)=19
ModifyGraph rgb(spec_VT095_n_SS)=(1,16019,65535)
SetAxis left -4.40425531914894e-08,5.55957446808511e-07
SetAxis bottom -0.00941051769868653,0.16067755017735
Cursor/P A spec_VT095_n 3
ShowInfo
EndMacro