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

 채택된 답변

Torsten
Torsten 2022년 2월 21일

0 개 추천

pf = normcdf(x,alpha,beta)

댓글 수: 3

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

Community Treasure Hunt

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

Start Hunting!

Translated by