Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Spectral Plot – Sinusodial Model

  • Last Updated : 02 Jul, 2021

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.

Attention reader! Don’t stop learning now. Get hold of all the important Machine Learning Concepts with the Machine Learning Foundation Course at a student-friendly price and become industry ready.



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}

Implementation:

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

Python3




# 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
sns.set_style('darkgrid')
 
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])
ax[1,0].set_title('Histogram')
sm.ProbPlot(beam_data[0]).qqplot(line='s', ax=ax[1,1],color='blue');
ax[1,1].set_title('Normal Probability Plot')
 
 
fig.suptitle('4-plot')
plt.show()

  • 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.

References:




My Personal Notes arrow_drop_up
Recommended Articles
Page :