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

조회 수: 9 (최근 30일)
Karl Rueth
Karl Rueth 2017년 11월 8일
댓글: Star Strider 2017년 11월 10일
I have this random signal, is it possible that I find the are under the curve ?
Thanks for any help provided.

채택된 답변

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan 2017년 11월 8일
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
Karl Rueth
Karl Rueth 2017년 11월 9일
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 2017년 11월 10일
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;

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

M
M 2017년 11월 8일
Try with this function
trapz
which does trapezoidal numerical integration.
  댓글 수: 1
Star Strider
Star Strider 2017년 11월 10일
The trapz (or cumtrapz) functions are the appropriate functions for this problem.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by