How to find are under the curve for a random signal.

9 visualizaciones (últimos 30 días)
I have this random signal, is it possible that I find the are under the curve ?
Thanks for any help provided.

Respuesta aceptada

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan el 8 de Nov. de 2017
If samples are all uniformly spaced in time, you just need to take the sum of all elements.
area_under_signal = sum(my_signal)
Note that this number will be proportional, but not exactly equal to the actual area. If you need the exact number, you need to multiply by the temporal resolution of your signal, dt.
area_under_signal = sum(my_signal)*dt
  2 comentarios
Karl Rueth
Karl Rueth el 9 de Nov. de 2017
Mr. Kaushik,
Thanks for your reply; when applying the "sum" method, it is giving me a vector which makes sense. However when trying to multiply it whit "dt" it is giving me an error: "Undefined function or variable 'dt'" , can you pleae guide me.
Thanks
Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan el 10 de Nov. de 2017
Of course, you need to define it before using. You should know the temporal resolution of your signal (how frequently you sample the signal). For example, if you have a vector of time points t at which you store your EMG signal x, then you can calculate dt and then use it to compute area:
dt = median(diff(t)); %median is just to take care of rounding errors
auc = sum(x)*dt;

Iniciar sesión para comentar.

Más respuestas (1)

M
M el 8 de Nov. de 2017
Try with this function
trapz
which does trapezoidal numerical integration.
  1 comentario
Star Strider
Star Strider el 10 de Nov. de 2017
The trapz (or cumtrapz) functions are the appropriate functions for this problem.

Iniciar sesión para comentar.

Categorías

Más información sobre Signal Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by