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

 Accepted Answer

pf = normcdf(x,alpha,beta)

3 Comments

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)))

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!