Home > Enterprise >  How to find the RMS value of an arbitrary wave form in python
How to find the RMS value of an arbitrary wave form in python

Time:08-29

I would like to calculate the RMS value of any waveform using its amplitude and time vectors. for example:

Amplitude =1000*np.array([0,0,0,0.00000121,0.00000113,0.00000104,7.00E-07,1.06E-22,1.06E-22,1.06E-22,1.06E-22,-1.06E-22,-5.00E-07,-1.06E-22,0.00000187,5.50E-07,-2.12E-22,-2.12E-22,-2.12E-22,-4.76E-22])
time = np.array([0,0.02,0.04,0.06,0.08,0.1,0.12,0.14,0.16,0.18,0.2,0.2,0.45,0.45,0.47,0.49,0.51,0.53,0.55,1.5])

CodePudding user response:

To compute RMS, you need to compute the integral of square of the Amplitude w.r.t time. This can be done with numpy.trapz From the definition of RMS, you can compute RMS as

RMS = np.sqrt(np.trapz(Amplitude**2,time)/(time[-1]-time[0]))
  • Related