Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all,
how can I extract major slopes of a line graph?(automatically, in c# or c++)
like the image below, there are three main slopes which is drawn in red on main graph

thanks in advance

<img src="https://dl.dropboxusercontent.com/u/968461/untitled.png" alt="Smiley" height="300" width="360">
Posted
Updated 21-Jul-14 22:33pm
v3
Comments
lukeer 22-Jul-14 4:58am    
First, you need to separate the main sections from one another, then you can compute their slopes.
Are those sections at the same position on the x-axis all the time?
Is there always the same count of sections?

Please update your question accordingly.

1 solution

What do you mean with 'major' slopes?
You know, the slope of a curve at is dy/dx, computed at the given point. If you have not the exact y(x) formula then you might use the approximation

C++
slope = (y2-y1)/(x2-x1)


where x1, x2 are 'close enough'.
 
Share this answer
 
v2
Comments
hesam_ipp 22-Jul-14 4:38am    
as i mentioned, i wana extract the slope of main areas of a graph
how can i write a program to automatically detect the major areas(e.g. three part in the image above)
CPallini 22-Jul-14 4:49am    
You have to define 'main area'. What you mean with it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900