Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Area under the curve
Replies: 9   Last Post: Nov 29, 2011 5:47 AM

 Messages: [ Previous | Next ]
 Claudio Posts: 16 Registered: 11/18/11
Re: Area under the curve
Posted: Nov 18, 2011 4:06 AM

Hi Prashant,

If I were you I would define a threshold for each peak type:
major_th = 1.5e-1;
minor_th = 4e-2;
% The thresholds could be adapted as a percentage of the highest peak found

I would then make a copy of the original signal in absolute value:
u_abs = abs(u)

Then I'd start searching for peaks beyond the minor_th threshold:
pos = find(u_abs > minor_th, 1 , 'first');
% Find previous zero_cross
% Find following zero_cross or derivative change (for pink areas) or lower threshold (for the green areas)

Once a peak is found, you can determine if it is a major or minor peak by finding the nearest max. You can do it the easy way:
peak_value = max( u_abs( pos - 0.5s : pos + 0.5s) )
if peak_value> major_th
% Area = Area of major Peak
% major peak value = peak_value;
else
% Area = Area of minor Peak
% minor peak value = peak_value;
end

The easy way will fail if the peaks' width change a lot. You could then do it the heard way, by searching for a zero in the derivative nearby (diff(u_abs)).

Finally, I'd check in the original signal if the area I just evaluated is positive or negative:

Area = sign( u(pos) ) * Area;

Good luck!
Claudio

"Prashant Sandhi" wrote in message <ja2p2q\$9cq\$1@newscl01ah.mathworks.com>...
> Dear Friends,
>
> Updating the picture with detailed measured outputs of my device.
>
> please have a look at this picture!
> http://img828.imageshack.us/img828/528/areapeaksamplitudetract.jpg
>
> One way I think to find the area and peak value of such a signal could be:
> u= my measured signal
>
> /*****code for +ve 2sec******/
>
> if ((u<0) && (u=zero_crossing)) % first Gray Area & Peak Value in the picture
>
> y_Area= Major Area under the curve % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> else if ((u>0) && (time=2sec)) % pink Area & Peak value
>
> y_Area=Major Area under the curbe % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> /*****code for zero V 4sec******Type-1******/
>
> if ((time>2sec) && (u==zero_crossing)) % Extract Gray Area & Peak Value
>
> y_Area= Major Area under the curve % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> else if ((u==zero_crossing) && (u <~Zero)) % Extract Green Area & Peak Value
>
> y_Area= Major Area under the curve % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> /*****code for -ve 2sec******/
>
> if ((u>0) && (u==zero_crossing)) % Extract Gray Area & Peak Value in the picture
>
> y_Area= Major Area under the curve % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> else if ((u==zero_crossing) && (........)) % pink Area & Peak value " ???????? "
>
> y_Area=Major Area under the curbe % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> /*****code for zero V 4sec******Type-2******/
>
> if ((time>2sec) && (u==zero_crossing)) % Extract Gray Area & Peak Value
>
> y_Area= Major Area under the curve % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> else if ((u==zero_crossing) && (u>zero) && (u <~Zero)) % Extract Green Area & Peak %Value because the curve lies in +ve side
>
> y_Area= Major Area under the curve % to skip small Areas
> y_peak_Val= Major peak value % to skip small Peak values
>
> end
>
> Will it be right to use such an approach for my problem?
> I think using 'time parameter' will cause problem because it may extract the first 'Pink area + peak value' but then the same pattern of signal will repeat and then my condition for time value is not any more satisfied...
>
> Best way to solve may be to program the code independent of time and independent of using a 'Input pulse' as reference
>
> Any suggestions will be of very useful.
>
> Thanking you!
>
> Prashant

Date Subject Author
10/28/11 Prashant
11/16/11 Prashant
11/17/11 Prashant
11/18/11 Claudio
11/18/11 Prashant
11/18/11 Claudio
11/18/11 Prashant
11/18/11 Claudio
11/24/11 Prashant
11/29/11 Prashant