Smoothing discrete line to approx. linear line w/ same vol.

discrete

New member
Joined
Jun 5, 2008
Messages
6
I need to come up with a funtion that will smooth a discrete line to approximate a linear line. The end points must remain constant and the volume under the smoothed line must be the same as the volume under the discrete line.

For example:
X 0% 100%
1 10 10
5 25 12.85
10 20 16.42
15 17 20
20 26 23.57
25 37 27.14
30 34 30.71
35 30 34.28
40 32 37.85
45 33 41.42
50 45 45

where 0% is the discrete line and 100% is the linear line (the do not have the same volume).

I've been using trapezoidal integration to find the volumes of the lines and i've tried formulas that relate to the difference between the discrete line and the linear line, both at an individual point and at the surround points, I'm just lost as to how to smooth the line keeping the volume constant.

Also, the x values and discrete points can change and the formula still needs to hold valid. It would be helpful to be able to manipulate the formula to get different smoothing percentages (25%, 50%, etc.).

Thank you for any help!
 
discrete said:
smooth
discrete line
linear line
smoothed line
Define these terms and there might be hope.

Is there some particular field of study under which this project falls? Maybe that information will provide a clue to what you are doing and what the actual requirements are.
 
discrete said:
I need to come up with a funtion that will smooth a discrete line to approximate a linear line. The end points must remain constant and the volume under the smoothed line must be the same as the volume under the discrete line.

For example:
X 0% 100%
1 10 10
5 25 12.85
10 20 16.42
15 17 20
20 26 23.57
25 37 27.14
30 34 30.71
35 30 34.28
40 32 37.85
45 33 41.42
50 45 45

where 0% is the discrete line and 100% is the linear line (the do not have the same volume).

I've been using trapezoidal integration to find the volumes of the lines and i've tried formulas that relate to the difference between the discrete line and the linear line, both at an individual point and at the surround points, I'm just lost as to how to smooth the line keeping the volume constant.

Also, the x values and discrete points can change and the formula still needs to hold valid. It would be helpful to be able to manipulate the formula to get different smoothing percentages (25%, 50%, etc.).

Thank you for any help!
In addition, (to tkhunny's request) you need to define:

volume under a line - generally we find area under the line (bounded between the line and x-axis, within the given domain). Generally, volume is calculated by rotating the area under the curve about a given axis.

smoothing percentage - how do you (how does your textbook or class-notes define it) calculate it? There are many algorithms to do it - which one do we want to use (will depend on your definition)?
 
For this suppose you are modeling a road, or some sort of terrain. The points are the elevation at certain distances from the starting point - the distances between the samples can change and the elevation at the points can change depending on the location being modeled.

Modeling this as a line it would be the area under the lines that needs to remain constant (thanks subhotosh), but in reality it would be the volume of material under your road. In trying to smooth the road you are trying to eliminate the elevation change along the road, moving material from one part of the road to another part. A completely smoothed road would be 100% - you've moved 100% of the material needed to make the linear line. 50% smoothed would be moving 50% of the material needed to make the linear line.

Thanks for the help!
 
If that's what 100% means, you'll have to explain the first 3 points.
 
tkhunny said:
If that's what 100% means, you'll have to explain the first 3 points.

Sorry, what 3 points do I need to clarify?

smooth - no elevation change except any elevation change from the first point to the last point (linear slope between them)

discrete line - I may have misworded this... I just mean a line made of individual points, your gps readings if you will, with no true function defining the line.
 
Okay, I think I get it. It remains a very odd problem. What you seem to be doing is only a smoothing but with one twist, the two endpoints are non-negotiable. The implication here is that the slope of the 100% version will be the same for all slopes excepting the first and the last. These boundaries could be just about anything.

Note: This is a dangerous business. Your boundary slopes could be catastrophic.
Note: Piece-wise linear is not a good idea for building roads. Matching at least first derivative with curves is the way you don't wreck cars trying to drive on these slopes.

Anyway...

Using the trapezoidal rule, I get 1390 volume from the original points and 1347 from the 100% data. This doesn't seem to meet your specifications.

I think the problem remains ill-defined.
 
tkhunny said:
I think the problem remains ill-defined.
Agreed. Having the original text of the exercise would probably prove very helpful.

Eliz.
 
Re:

stapel said:
tkhunny said:
I think the problem remains ill-defined.
Agreed. Having the original text of the exercise would probably prove very helpful.

Eliz.


I appreciate the feedback so far. This is actually part of a larger project, and thus there is no "wording" to give. Basically this portion is taking an exsiting road and smoothing it some percentage (as above). There are predefined rules for elevation change radius' so we don't have to worry abou the abrupt change. All I'm concerned with at this time is smoothing an existing semi-straight portion of road to a near constant grade.
 
...and you don't have very specific guidelines in various formal code documents?

It does appear to be a worthwhile problem, but it needs a better definition in order for there to be a better answer.
 
I also can't quite follow this.

Using a VERY simplified case involving area:

Say 3 isosceles triangles are side by side, left to right: bases = 14,6,10 and respective heights = 24,4,12.

So the base line is 30 in length, and looks like: A......(14)......B...(6)...C....(10)....D

Respective areas are 168, 12 and 60: total 240

We want a rectangle with base line as a side, with area 240: 240 / baseline = 240/30 = 8

So required rectangle is 8 by 30.

So effectively the triangles have been "sliced off" at height 8 (not necessarily all the triangles;
here, the middle one is "buried") and the sliced off portions somehow "inserted" in a manner
resulting in the rectangle......

Your problem I take it is somewhat similar to this, but with volume instead of area, the "triangles"
being "hills", some of which are topped off, the portion topped off used to fill "cavities" : am I nuts???!!!
 
Top