I have an analog signal as shown below.
As you can see it has a DC component, a 1MHz component and some high order component.
The period of the signal is 8.0199667µs.
I want to see a good accurate frequencies up to 10MHz.
I have captured a signal 78.97518µs long.
Its edges are not absolutely equal so my fft will get distorted because of the discontinuity.
Also the LTSPICE program is not sampling the signal equally so I am doing cubic spline to create a "continues" signal which I will try to resample again using cubic spline.
The full sample table which I interpolate is shown in the link below. I have made cubic spline interpolation and resampled it in python at 1/1e7 time gaps as shown in the code below.
How do I create in python a proper windowing to cancel the discontinuity as much as possible?
from scipy.fftpack import fft
#import plotly
#import chart_studio.plotly as py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.widgets import Cursor
from gekko import GEKKO
#%matplotlib qt
new_x=np.arange(0,7.89752e-05,1/(1e7))
dataset_fft=pd.read_table("sinus_1mhz.txt")
array_fft=dataset_fft.values
m=GEKKO()
m.x=m.Param(new_x)
m.y=m.Var()
m.cspline(m.x,m.y,array_fft[:,0],array_fft[:,1])
m.options.IMODE=2
m.solve(disp=False)
fig=plt.figure()
ax=fig.subplots()
ax.grid()
cursor=Cursor(ax, horizOn=True,vertOn=True,useblit=True,color='r',linewidth =1)
#plt.plot(array_fft[:,0],array_fft[:,1])
plt.plot(m.x,m.y)
plt.xlabel("time")
plt.ylabel("amp")
plt.show()