Attempting to fit data with a sigmoid curve, but not an option in curvefitter toolbox
31 次查看(过去 30 天)
显示 更早的评论
I am working on fitting data with a sigmoidal curve, but my CurveFitter toolbox does not have the sigmoidal option under fit types. I have tried a custom fit, but it is not giving me any useable fits.
eqn:
'a/(1+exp(-b*(x-c)))'
0 个评论
回答(3 个)
Star Strider
2024-8-21,19:15
Perhaps something like this —
s = fittype('a/(1+exp(-b*(x-c)))', 'Coefficients',{'a','b','c'}, 'Independent','x', 'Dependent','y')
x = linspace(0, 10, 20);
y = rand(size(x));
sfit = fit(x(:), y(:), s)
figure
plot(sfit, x, y)
grid
.
0 个评论
Sam Chak
2024-8-21,20:01
rng(0,"twister")
x = linspace(-1, 1, 101)';
y = 1./(1 + exp(- 10*x)) + 0.02*randn(101, 1);
y(y>1) = 1;
y(y<0) = 0;
logsigm = fit(x, y, 'logistic')
plot(logsigm, x, y), grid on, grid minor
0 个评论
Image Analyst
2024-8-21,22:16
Attach your actual data so we can work with it. In the meantime, I'm attaching my demo of fitting a sigmoid, though it uses a different formula than yours. However, you can adapt it to use your formula.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1757379/image.png)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!