×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# "Convex" curve or "convex" surface in Matlab

## "Convex" curve or "convex" surface in Matlab

(OP)
Hi everybody,

I have a mesured surface (which is represented by a set of mesured points (black) in the attached figure).

The problem is that I've try to find the way to create the "convex" curve (in red) in Matlab. Anyone have an idea about this ?

This problem will be extended that he case of 3D. Then the "convex" curve becomes the "convex" surface.

Replies continue below

### RE: "Convex" curve or "convex" surface in Matlab

Isn't it basically a regression problem?  Depends on what type of curve you want to fit, but they're all basically the same approach; the curve has to be complex enough to have the degrees of freedom necessary to fit the selected points.

### RE: "Convex" curve or "convex" surface in Matlab

(OP)
Thanks IRstuff but it's not exactly a regression problem.

I've searched in the Curve Fitting Toolbox of Matlab (or the functions of interpolation), but it's not that I need.

According to the attached image and as I know about the Curve Fitting Toolbox, Matlab can only create the curves like in a) and b).

The one that I need is described in c) : a "convex" line.

I've thought to programme with Matlab, but I haven't any ideas for detecting the points of the "convex" line. Anyone have an idea or a keyword for me to search ?

Best regards,

### RE: "Convex" curve or "convex" surface in Matlab

If you'll recall, I mentioned that the selected curve must have sufficient degrees of freedom, but not overly so.  In your examples, assuming they're actual fits, the curve has WAY to many degrees of freedom.  In your specific case, you need to be looking for something like a 2nd or 3rd degree polynomial, and no more than that.

### RE: "Convex" curve or "convex" surface in Matlab

You know what could beautifully approximate that.
A trained F Neural Network.

Fe

### RE: "Convex" curve or "convex" surface in Matlab

I may be simplifying, but how about:

Solve {Ak, Bk, Ck} to Minimize Sumk(yk-yhatk)^2
where
yhatk is kth estimate of yk, in the form yhatk = A0k + A1k*xk + A2k*xk^2

subject to constraints:
1: yk>=yhatk for all k (ensures the curve stays on one side of the data)
2: A2k > 0 for all k (ensures curve is convex up if that is desired)

=====================================
(2B)+(2B)'  ?

### RE: "Convex" curve or "convex" surface in Matlab

Let me try again:

Two versions:

First version gives simple single quadratic:
Solve {A1, A2, A0} to Minimize Sumk(yk-yhatk)^2
where
yhatk is kth estimate of yk, in the form yhatk = A0 + A1*xk + A2*xk^2

subject to constraints:
1: yk>=yhatk for all k (ensures the curve stays on one side of the data)
2: A2 > 0 (ensures curve is convex up if that is desired)

A more advanced version would be a quadratic spline, with same coefficients A0,A1, A2 on each interval, and with some kind of constraint on slopes of adjacent intervals to help ensure convex. Note it is not a true spline since it won't match in each interval, but with right constraints could be found by minimization problem.

=====================================
(2B)+(2B)'  ?

### RE: "Convex" curve or "convex" surface in Matlab

(OP)
Thanks.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!