# Finding a propriate function to fit "U" curve

9 views (last 30 days)
Shilin Shi on 9 Mar 2022
Answered: Bruno Luong on 12 Aug 2022
I am trying to fit this data, but the CFT doesn't support a function that can fit my data(The curve of which is similar to the curve of Paschen's Law). Thanks a lot!
x=[0.17 0.33 0.83 1.67 2.5 3.33 5];
y=[6.62466 5.58235 4.63169 5.08213 5.4159 5.81769 6.77988];
KSSV on 9 Mar 2022

Sam Chak on 9 Mar 2022
I'm not an expert in High Voltage Engineering. Please clarify if the following rational logarithmic function describes the Paschen's law (as shown in wikipedia): .
The local minimum point can be obtained by solving , that is .
The singular point can be found by solving the denominator  .
There are only 7 data points. If is assumed to be the local minimum, the closest I can get using fsolve is
function F = paschen(x)
F(1) = x(1)*0.17/(log(x(2)*0.17) - log(log(1 + 1/x(3)))) - 6.62466;
F(2) = x(1)*0.83/(log(x(2)*0.83) - log(log(1 + 1/x(3)))) - 4.63169;
F(3) = x(1)*2.5/(log(x(2)*2.5) - log(log(1 + 1/x(3)))) - 5.4159;
F(4) = x(1)*5/(log(x(2)*5) - log(log(1 + 1/x(3)))) - 6.77988;
F(5) = (x(1)*(-1 + log(x(2)*0.83) - log(log(1 + 1/x(3)))))/(log(x(2)*0.83) - log(log(1 + 1/x(3))))^2;
F(6) = (1/x(2))*log((x(3) + 1)/x(3)) - 0.01; Interpolations can be made to generate more points. However, it is preferable if you can provide more data points from your experiments. You probably need assistance from the MATLAB Data Scientists here.
Bjoern Mulder on 12 Aug 2022
Thank you for your post - I was also looking into the Paschen Law and your input helped!
I think I found an error while going through your solution
Instead of it should be .
And then to give the point where .
All was missing is an exp(1).
Have a great day!

Walter Roberson on 9 Mar 2022
polyfit degree 4 is not bad
##### 2 CommentsShowHide 1 older comment
Alex Sha on 12 Aug 2022
If don't mind the type of function, one like below is good enough:
y = p1*x^p2+p3*exp(x*p4)+p5*x+p6
Sum Squared Error (SSE): 0.00904817231315977
Root of Mean Square Error (RMSE): 0.0359526917592704
Correlation Coef. (R): 0.998760578765123
R-Square: 0.997522693695244
Parameter Best Estimate
--------- -------------
p1 -344.434477549634
p2 0.970653631107029
p3 -61.0490424042631
p4 -0.452522236917936
p5 316.980679039058
p6 70.9562319738469 if using polyfit degree 4 as suggesting by Walter Roberson, the result will be:
y = b0+b1*x+b2*x^2+b3*x^3+b4*x^4
Sum Squared Error (SSE): 0.142268105538466
Root of Mean Square Error (RMSE): 0.142562319975945
Correlation Coef. (R): 0.980330710558373
R-Square: 0.961048302063885
Parameter Best Estimate
--------- -------------
b0 7.45157976927911
b1 -6.56400689174901
b2 4.88283965405082
b3 -1.32215012121595
b4 0.120562079736417 if using polyfit degree 5:
y = b0+b1*x+b2*x^2+b3*x^3+b4*x^4+b5*x^5
Sum Squared Error (SSE): 0.00749681365182146
Root of Mean Square Error (RMSE): 0.0327257296149626
Correlation Coef. (R): 0.998973193543668
R-Square: 0.997947441418835
Parameter Best Estimate
--------- -------------
b0 8.10062144754325
b1 -10.6880037795643
b2 11.4448441863131
b3 -5.2716887492359
b4 1.10497426429342
b5 -0.0850079361618652 Bruno Luong on 12 Aug 2022
This is the best I come up with using BSFK FEX
x=[0.17 0.33 0.83 1.67 2.5 3.33 5];
y=[6.62466 5.58235 4.63169 5.08213 5.4159 5.81769 6.77988];
pp=BSFK(x,y,3,4);
xi=linspace(min(x),max(x));
yi=ppval(pp,xi);
plot(x,y,'or',xi,yi,'b') ### Categories

Find more on Interpolation in Help Center and File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!