please help me to find out mathmatical function between X and Y

2 views (last 30 days)
for example
x=[0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1]
y=[89.72308444 89.21117298 88.69692085 88.18020302 87.66088218 87.13880655 86.61380705 86.08569379 85.55425157 85.0192342 84.48035703 83.9372872 83.38963067 82.83691475 82.27856424 81.71386818 81.14193297 80.56161474 79.97142004 79.36935656 78.75270387 78.11765265 77.45872388 76.7678153 76.03261795 75.23400847 74.34196715 78.30969848 77.07114557 75.9480519 74.94218396 74.03486878 73.20106164 72.41872047 71.67135281 70.94735035 70.23865101 69.53960043 68.84614818 68.15531367 67.46483672 66.77294781 66.07821495 65.37943962 64.67558442 63.96572164 63.24899546 62.52459342 61.79172401 61.04959825 60.29741384 59.53434075 58.75950745 57.97198693 57.17078199 56.35480903 55.52287962 54.67367898]
  1 Comment
Morteza
Morteza on 18 Aug 2015
In fact there are infinite number of equation can be fitted between these data. But BASIC-FITTING can let you to find the equation according to the fitting function that you select....

Sign in to comment.

Accepted Answer

Morteza
Morteza on 18 Aug 2015

More Answers (1)

Walter Roberson
Walter Roberson on 18 Aug 2015
Your data has a discontinuity at the 28th point. If you separate the two portions, you can get a pretty decent fit with a pair of cubic polynomials and an very good fit with a pair of quartic polynomials.
d = 3; N = 27; plot(x,y, 'b', x(1:N), polyval(polyfit(x(1:N),y(1:N), d), x(1:N)),'r', x(N+1:end), polyval(polyfit(x(N+1:end),y(N+1:end),d), x(N+1:end)), 'g')
and change to d = 4 for the quadratic.
If on the other hand you try to fit the whole thing with one polynomial, then
d = 9; plot(x,y, 'b', x, polyval(polyfit(x,y, d), x),'r')
and you can see that the portion near 0.7 is not satisfactory. If you go for d = 10 or higher you will get warnings about bad conditionining. By d = 25, you will still not be seeing a good transition near 0.7 but you will be starting to see notable errors at the right hand side. By d = 30 you get:
which is not satisfactory at the centre or the edges.
When you have a discontinuity like this, although mathematically you can fit it using a polynomial, the reality in the world of finite precision values is that you cannot do a good job of fitting it numerically.
You need to reconsider whether a polynomial is appropriate for your system.
  2 Comments
rahman sajadi
rahman sajadi on 18 Aug 2015
there is a point between .68 and .7 (.69) and in this point my function is Discontinuous.so not importanat in this part of curve for me
thank u for your answers
Walter Roberson
Walter Roberson on 18 Aug 2015
The discontinuity is going to affect the coefficients for the polynomial, unless you break it up into two polynomials like I did here. If it is acceptable that the fit is not very good near 0.7 then why not just fit to a straight line?

Sign in to comment.

Categories

Find more on Polynomials in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!