-3

The Matlab code I have plots the following curve:

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

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

enter image description here

how can I calculate the area in the red circle?

Marco
  • 2,007
  • 17
  • 28
Moosli
  • 3,140
  • 2
  • 19
  • 45
  • 1
    What have you tried to get this area? I take it you are familiar with high school mathematics and thus know that this is called an integral, or Riemann sum in discrete numerics. Start using your favourite search engine for those terms, as this question is currently too broad for SO, as well as having too little effort and not enough information to go on (i.e. what are the points you're actually looking for? The zero crossings? A freehand red circle? etc) – Adriaan Feb 16 '18 at 20:10

1 Answers1

1

You need to find the 2nd and 3rd zero cross (z2 and z3). then do a sum over the tmp. Something like this:

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

Nick X Tsui
  • 2,737
  • 6
  • 39
  • 73