How can I create this Cumulative Normal (Gaussian) Psychometric Function?

I am trying to create a function for the above, but this gives me errors.
function [a] = cumGaussPF(x,beta,alpha)
fx = @(x,beta,alpha) exp(-0.5*((x-alpha)/beta).^2);
pf = 1/(beta*sqrt(2*pi))*integral(@(x) fx(x,beta,alpha),-inf,x);
end

 Respuesta aceptada

Torsten
Torsten el 21 de Feb. de 2022
pf = normcdf(x,alpha,beta)

3 comentarios

Thanks, after seeing your answer - I saw that this is exactly what I am trying to do. Thanks a great deal.
normcdf is a function from the Statistics and Machine Learning Toolbox.
If your code should not depend on a licence for this toolbox, you can also use
pf = 0.5*(1 + erf((x-alpha)/(sqrt(2)*beta)))

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by