I have about 100 data points which mostly satisfying a certain function (but some points are off). I would like to plot all those points in a smooth curve but the problem is the points are not uniformly distributed. So is that anyway to get the smooth curve? I am thinking to interpolate some points in between, but the only way that comes up to my mind is to linearly insert some artificial points between two data points. But that will show a pretty weird shape (like some sharp corner). So any better idea? Thanks.
I have about 100 data points which mostly satisfying a certain function (but some
Share
If you know more or less what the actual curve should be, you can try to fit that curve to your points (e.g. using
polyfit). Depending on how many points are off and how far, you can get by with least squares regression (which is fairly easy to get working). If you have too many outliers (or they are much too large/small), you can also try robust regression (e.g. least absolute deviation fitting) using therobustfitfunction.If you can manually determine the outliers, you can also fit a curve through the other points to get better results or even use interpolation methods (e.g.
interp1in MATLAB) on those points to get a smoother curve.