Fitting Cumulative Gaussian Function to Data Points

4 Ansichten (letzte 30 Tage)
TS
TS am 18 Mär. 2021
Kommentiert: Matt J am 19 Mär. 2021
Hello,
I am trying to fit the cumulative Gaussian Function to my data points, to find out the PSE. So far I used this function:
f = @(b,x_values) normcdf(x_values, b(1), b(2)); % Objective Function
NRCF = @(b) norm(yVorB - f(b,x_values)); % Norm Residual Cost Function
B1 = fminsearch(NRCF, [-1; 5]); % Estimate Parameters
x = 0:5
y = [0.7 0.4 0.2 0.4 0.6 0.9]
I am getting: 1.81051
However, the correct value should be: 1.91293286. Does anyone have ideas? Is there a better way to fit the cumulative function to my data in Matlab?
Thank you for your help :)

Akzeptierte Antwort

Matt J
Matt J am 18 Mär. 2021
Bearbeitet: Matt J am 18 Mär. 2021
Your data points don't look anything like a CDF to me (no monotonic trend of any kind), but one of the estimated parameter values I get is pretty close to what you say you're looking for.
format long
x = 0:5;
y = [0.7 0.4 0.2 0.4 0.6 0.9];
f = @(b,x_values) normcdf(x_values, b(1), b(2)); % Objective Function
NRCF = @(b) norm(y - f(b,x)); % Norm Residual Cost Function
params = fminsearch(NRCF, [-1; 5]) % Estimate Parameters
params = 2×1
1.912932525139948 7.839459850514324
  2 Kommentare
TS
TS am 19 Mär. 2021
Hey,
thank you for your quick answer! Sorry, I just saw that I am getting 1.91, however the correct answer is 1.81. Sorry, I messed them up.
Because I used the same way as you to figure out PSE so far. You did not change anything in the function, if I am correct?
Matt J
Matt J am 19 Mär. 2021
My definition of NRCF is different from yours. It uses y and x instead of yVorB and x_values.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by