×
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.

# How can I make a curve smoother?

## How can I make a curve smoother?

(OP)
Hi,

I am plotting a set or results I have, for instance (this is a piece of code):

X=[70:-3:0];
example=[1.6626E-12 3.4713E-12 1.2833E-11 5.0116E-11 1.9644E-10 7.7019E-10 3.0197E-09 1.1840E-08 4.6420E-08 1.8200E-07 7.1358E-07 2.7978E-06 1.0969E-05 4.3008E-05 1.6863E-04 6.6114E-04 2.5922E-03 1.0163E-02 3.9847E-02 1.5623E-01 6.1255E-01 1.0000E+00 1.0000E+00 1.0000E+00];
plot(X,example)

As you can see in the figure, as I do not have too many results in some points, there are sharp point that I'd like to make them smoother. I have been trying to do it with the functions 'polyfit and polyval' and on the other hand with the function 'smooth' but I didn't get the results I'd like to. Can any anyone give me any suggestion?

### RE: How can I make a curve smoother?

Best if you explain what results you'd like. polyfit and smooth will do what they say. Your data is very much not smooth to start with, so any smoothing algorithm is going to struggle. Maybe you could try pre-processing the data first - only you know what pre-processing is valid given the data source, but you could start by doing something about that huge change in gradient at around X=8. What about just smoothing the data beyond that point? At least from then on it looks like there might be a satisfactory interpolation. For values of X<20, there are just not enough samples to form any conclusion on how the large changes in gradient should be smoothed.

### RE: How can I make a curve smoother?

Perhaps you should consider a spline fit. I think you need to decide whether it's plausible to have the curve smooth in certain spots. Certainly, from your data, there are points that have no plausible explanation for why they might be on a smooth curve.

TTFN
FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

### RE: How can I make a curve smoother?

Without any description of what you don't like it is hard to answer but a quick stab and I would recommend monotonic interpolation maybe?

Here is a pic of what I mean is attached with the axis scaled to show the points I would be concerned about.

Hope that helps and good luck,

- J -

#### 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!