Skip to content
Advertisement

nan in interp1d scipy

I have the following code that I am working on in python with interp1d and it seems that the output of the interp1d times the query points outputs the beginning values of array as NaN. Why?

JavaScript

The first 20 values in WdB are :

JavaScript

The following is the same outputted in maltab for the first 20 values:

JavaScript

How can I avoid this and actually have real values like matlab does with interp1d?

Advertisement

Answer

I do not know exactly the reason, but the fit actually works when looking at the plotted data.

JavaScript

The plot looks as follows:

Data-Plot

The interpolation is actually happening, but the fitting is not as good as desirable. But if your intention is to fit your data, why don’t you use a spline interpolator? Which is still cubic but less prone to overloads.

JavaScript

enter image description here

And the data and plots come out very smoothly.

JavaScript
Advertisement