Finding a propriate function to fit "U" curve
5 views (last 30 days)
Show older comments
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];
Answers (3)
Sam Chak
on 9 Mar 2022
Hi @Shilin Shi
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):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919769/image.png)
The local minimum point can be obtained by solving
, that is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919774/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919779/image.png)
The singular point can be found by solving the denominator
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919784/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919789/image.png)
There are only 7 data points. If
is assumed to be the local minimum, the closest I can get using fsolve is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919794/image.png)
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;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919799/image.png)
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.
1 Comment
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
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096465/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096470/image.png)
And then
to give the point where
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096475/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096480/image.png)
All was missing is an exp(1).
Have a great day!
Walter Roberson
on 9 Mar 2022
polyfit degree 4 is not bad
2 Comments
Sam Chak
on 9 Mar 2022
Edited: Sam Chak
on 9 Mar 2022
I think @Shilin Shi is trying to fit the data using the Paschen's Rational Logarithmic Function. Perhaps you can provide some insights on this matter.
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096545/image.jpeg)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096550/image.jpeg)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096555/image.jpeg)
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')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096740/image.png)
0 Comments
See Also
Categories
Find more on Curve Fitting Toolbox 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!