Matlab中本身有Q函数,即qfunc()其反函数是qfuncinv()
--------------------------------
helpqfunc
qfunc
Qfunction
Syntax
y=qfunc(x)
Description
y=qfunc(x)isoneminusthecumulativedistributionfunctionofthestandardizednormalrandomvariable,evaluatedateachelementoftherealarrayx.Forascalarx,theformulais
TheQfunctionisrelatedtothecomplementaryerrorfunction,erfc,accordingto
Examples
TheexamplebelowcomputestheQfunctiononamatrix,elementbyelement.
x=[012;345];
formatshorte%Switchtofloatingpointformatfordisplays.
y=qfunc(x)
format%Returntodefaultformatfordisplays.
Theoutputisbelow.
y=
5.0000e-0011.5866e-0012.2750e-002
1.3499e-0033.1671e-0052.8665e-007
--------------------------------------------
helpqfuncinv
qfuncinv
InverseQfunction
Syntax
y=qfuncinv(x)
Description
y=qfuncinv(x)returnstheargumentoftheQfunctionatwhichtheQfunction'svalueisx.Theinputxmustbearealarraywithelementsbetween0and1,inclusive.
Forascalarx,theQfunctionisoneminusthecumulativedistributionfunctionofthestandardizednormalrandomvariable,evaluatedatx.TheQfunctionisdefinedas
TheQfunctionisrelatedtothecomplementaryerrorfunction,erfc,accordingto
Examples
Theexamplebelowillustratestheinverserelationshipbetweenqfuncandqfuncinv.
x1=[012;345];
y1=qfuncinv(qfunc(x1))%Invertqfunctorecoverx1.
x2=0:.2:1;
y2=qfunc(qfuncinv(x2))%Invertqfuncinvtorecoverx2.
Theoutputisbelow.
y1=
012
345
y2=
00.20000.40000.60000.80001.0000
