Skip to content
Related Articles
Open in App
Not now

Related Articles

Spectral Plot – Sinusoidal Model

Improve Article
Save Article
  • Last Updated : 31 Oct, 2022
Improve Article
Save Article

The spectral plot is used to demonstrate the single dominant frequency of the plot. This indicates that the single cycle sinusoidal model might be appropriate.

Consider the above plot, Let’s assume that the plot has distribution as follows:

Y_{i} = A_{0} + E_{i}

Now, we try to estimate the constant by the sample mean. This type of analysis would lead to an incorrect conclusion because:

  • The sample mean is biased
  • The confidence interval (CI) for the mean is too small.

Here, the proper choice of model is likeY_{i} = C + \alpha\sin{(2\pi\omega t_{i} + \phi)} + E_{i}

Y_{i} = C + \alpha\sin{(2\pi\omega t_{i} + \phi)} + E_{i}

where, a (alpha) is the amplitude, and w (omega) is the frequency of the observation and phi is the phase difference.

The next steps after this :

  • Estimate the frequency of the spectral plot, this would be helpful in starting the value of subsequent non-linear fitting. We can use the Complex Demodulation phase plot to estimate it.
  • Do a complex demodulation Amplitude plot to estimate the amplitude of the plot and to determine whether a constant amplitude is sufficient.
  • Perform a non-linear fit of the model on the dataset.

Y_{i} = C + \alpha\sin{(2\pi\omega t_{i} + \phi)} + E_{i}


  • In this implementation, we will be using a beam deflection case study, the dataset can be downloaded from here.


# necessary imports
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
%matplotlib inline
sns.mpl.rcParams['figure.figsize'] = (20.0, 15.0)
# read beam data
beam_data = pd.read_csv('beam_Deflection.txt', header=None)
# draw 4 plot
fig, ax  = plt.subplots(2,2)
sns.lineplot(x= pd.Series(beam_data.index),y =beam_data[0],ax =ax[0,0])
ax[0,0].set_title('Run Sequence Plot')
pd.plotting.lag_plot(beam_data[0],ax =ax[0,1])
ax[0,1].set_title('Lag Plot with k=1')
sns.histplot(beam_data[0],kde=True,ax =ax[1,0])
sm.ProbPlot(beam_data[0]).qqplot(line='s', ax=ax[1,1],color='blue');
ax[1,1].set_title('Normal Probability Plot')

  • The 4-plot(Lag plot) clearly shows that there is some periodic type of function that can be used to describe the dataset. Now, Let’s assume that the data can be fitted by the following equation:

Y_{i} = C + \alpha\sin{(2\pi\omega t_{i} + \phi)}

  • Now, we plot the complex demodulation phase plot and complex demodulation amplitude plot to get the frequency and amplitude of the above equation. You can know more about how to plot complex demodulation phase and amplitude plot from here.
  • The complex demodulation phase plot gives the frequency of 0.3025 and the complex demodulation amplitude plot gives the amplitude of around 390 after a cold start.


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!