Sigmoid function shaping and fitting by curve-fitting toolbox
Afficher commentaires plus anciens
Hi all,
I am trying to fit a sigmoid function to my data.
Basicaly,
x=1 2 3 4 5 6 7 48
y= 119 163 240 395 617 1461 4310 36955464
first seven data are Electric Vehicles in a country corresponding to year number 1 to 7, and last data (48, 36955464) is the 48th year data.
I have fitted a Logistic Curve as y=36.955.464/(1+119*e^-0,425x)
However, although it fits my data well and ends up showing an expected curve, I need to shape the curve a bit. For instance, parabolic part of the logistic function has to be a bit stronger (neds to increase a bit faster), while exponential part of the sigmoid curve should increase slower.
Is there any other suggestion to fit an adjustable Sigmoid Curve to build up a nicer curve? For example, if I prefer to construct a Hyperbolic Tangent curve (which is also a S-shaped function) how should I construct it ?
Best wishes to all Matlab community
Réponse acceptée
Plus de réponses (1)
Hi @Batuhan
Edit 2: Since the shape of the Black curve is preferred, Gompertz function is proposed for the fitting.
Click on the link to understand how you can adjust parameters b and c to obtain the fine-tune desired shape.
% Data
x = [1 2 3 4 5 6 7 48];
y = [119 163 240 395 617 1461 4310 36955464];
% Proposed non-symmetrical S-shaped Gompertz function
xx = linspace(1, 48, 47001);
a = 36955464; % a stands for amplitude (max value of y data)
b = 5.631e-09; % adjust the displacement in x-axis (if d is tuned, leave b = 0)
c = 0.2184; % growth rate (or the slope)
d = 17.08; % adjust the displacement in x-axis (if b is tuned, leave d = 0)
yy = a*exp(-exp(-b - c*(xx - d)));
plot(xx, yy, 'linewidth', 1.5), hold on
plot(x, y, 'ro', 'MarkerSize', 10)
grid on, xlabel('x'), ylabel('y'), hold off
legend('Gompertz', 'data', 'location', 'northwest', 'FontSize', 10)
General Gompertz model:
f(x) = a*exp(-exp(-b - c*(x - d)))
Coefficients (with 95% confidence bounds):
a = 3.7e+07 (3.654e+07, 3.746e+07)
b = 5.631e-09 (fixed at bound)
c = 0.2184 (-0.04142, 0.4782)
d = 17.08 (5.059, 29.09)
Goodness of fit:
SSE: 1.555e+06
R-square: 1
Adjusted R-square: 1
RMSE: 557.7
2 commentaires
Batuhan
le 5 Juil 2022
Sam Chak
le 5 Juil 2022
No, you won't get there. A large portion of the data in the central region are unavailable. So, there are many Sigmoids can fit these 8 points. However, I don't think that the curve-fitting algorithm can intelligently fit the Sigmoid model without making a few assumptions.
Based on your preference of the Black curve, I probably won't use Sigmoids.
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







