Calculate area from a signal
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Julio Martín
el 10 de Feb. de 2022
Editada: Julio Martín
el 13 de Feb. de 2022
Hi, would like to calculate area from this emg signal
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/890890/image.jpeg)
There are three different channels. I've done RMS and snap the exact tiem I need to analyse but don't know how to calculate total area
My code is:
for c=2:2
A=strcat('S1_',num2str(c));
B=strcat(A,'.emt');
D=importdata(B,'\t',12);
[F, C]=size(D.data);
x=filter(Filtro_emg,D.data);
centro=(F-mod(F,2))/2;
x=x(((centro-4000)+242:(centro-4000)+3026),:);
RMS = Rms_emg (x,100)*1000;
S=smoothdata(RMS);
plot(S);
for b=3:5
Areatotal(b,c)=sum(S(:,b)); I've tried with this, but don't know if it's correct
Media(b,c)=mean(S(:,b));
Maximo(b,c)=max(S(:,b));
end
end
Please help, thanks!
0 comentarios
Respuesta aceptada
AndresVar
el 10 de Feb. de 2022
Editada: AndresVar
el 10 de Feb. de 2022
You can use trapezoidal rule: see trapz: Trapezoidal numerical integration - MATLAB trapz (mathworks.com)
area = trapz(x,y) % i think for you trapz(S(:,b)) or just trapz(S(:,b)) if dx = 1
sum also works so you can compare your result. You must multiply the sum by dx, but it looks like dx=1 in your case.
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!