从基线下的信号计算面积

时间:2018-02-16 19:48:40

标签: matlab area

我在Matlab代码中绘制了以下曲线:

X1= 1:600;
plot (X1,tmp)

basline = 0;% level
area(tmp,basline,'FaceColor','g');

enter image description here

如何计算红圈中的面积?

1 个答案:

答案 0 :(得分:1)

你需要找到第2和第3个零交叉(z2和z3)。然后对tmp做一笔总结。像这样:

X1= 1:600;
tmp = sin(0.03*X1);
plot (X1,tmp)
range = 209:314;
basline = 0;% level
area(tmp,basline,'FaceColor','g');
figure;area(tmp(range),basline,'FaceColor','g');

sum(tmp(range))

enter image description here

enter image description here