# Finding the inflection point of a sigmoid function

27 ビュー (過去 30 日間)
Iddo Weiner 2017 年 12 月 18 日
コメント済み: Iddo Weiner 2017 年 12 月 18 日
Hi, here's my function:
% define params
p1 = 0.0389;
p2 = 1.9158;
p3 = 162.4272;
p4 = 0.012;
% simulate the function
syms x
f = p1+(p2-p1)/(1+10^((p3-x)*p4));
fplot(f,[1 245]) Now, I would like to find the inflection point (I manually drew where I roughly expect it to be).
Here's what I was trying to do:
double(solve(f,'MaxDegree',3))
but I get this:
ans = 2.1394e+01 - 1.1370e+02i
Which means that there is no real inflection point... Where's my mistake?
Iddo

サインインしてコメントする。

### 採用された回答

Star Strider 2017 年 12 月 18 日
Try this:
p1 = 0.0389;
p2 = 1.9158;
p3 = 162.4272;
p4 = 0.012;
% simulate the function
syms x
f(x) = p1+(p2-p1)/(1+10^((p3-x)*p4));
inflpt = vpasolve(diff(f,2) == 0); % Calculate Inflection Point
figure(1)
fplot(f,[1 245])
hold on
plot(inflpt, f(inflpt), 'pr', 'MarkerSize',10, 'MarkerFaceColor','g')
hold off
##### 4 件のコメント表示非表示 3 件の古いコメント
Iddo Weiner 2017 年 12 月 18 日
Yes, setting the 2nd derivative to equal zero will give you the inflection point

サインインしてコメントする。

### その他の回答 (1 件)

Roger Stafford 2017 年 12 月 18 日

The inflection point occurs at x = p3. You can show it by using the symbolic 'diff' to find the second derivative of f with respect to x and finding the x that makes it zero. That occurs when 10^((p3-x)*p4)) is equal to 1 which forces x to equal p3.
##### 1 件のコメント表示非表示 なし
Iddo Weiner 2017 年 12 月 18 日
Hey Roger, thanks for your help.
I understand what you say and it's right for this case, but I would like to have a piece of code that automatically calculates the inflection point.. Looking at the official documentation it looked like this line of code is supposed to do the work:
double(solve(f,'MaxDegree',3))
But, it didn't work.. So do you see a different way to automatically generate the inflection point? Or maybe I'm not using solve() properly?
Thanks, Iddo

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!