Discrete values of abscissa for a function

12 views (last 30 days)
Hi, I am retrieving x vs y values of a curve, originally plotted on a paper, using a plot digitizing software. The problem is that I cannot get equal intervals of x using this software. For eg. the x array after digitizing will be irregular, like 1 4 5 7 9 ...... But for my further operations, which is inputting these values in a math model, I require the x array to be of regular intervals. Is there a suitable method in Matlab through which this can be achieved?? I have tried representing the x vs y function using polynomial curve fitting, but the curve is too complex to be appropriately represented with polynomials (there are about 200 points in the x and y array). Is there a method in Matlab that can convert the abscissa i.e x array in regular intervals and compute approximately the corresponding y, so that the overall shape of the function is preserved? Hope the problem is clear.
Thanks

Accepted Answer

Star Strider
Star Strider on 5 Nov 2014
There are two funcitons I would use: linspace to create a regularly-spaced abscissa vector, and interp1 to calculate the corresponding ordinate values. You may have to experiment with the various ‘method’ options of interp1 to get the result you want, since the default linear method may not be appropriate for your data.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!