function fy=tsquare(fx) % tlinear(fx) Generates a probability function fy where Y=g(X), g(X)=X^2, % and X has probability function fx. May require use of the % smooth function. if ispf(fx)==0 error('not a valid probability function') end x=xvals(fx); p=pvals(fx); L=length(x); ax=abs(x); ylow=(min(ax))^2; yhigh=(max(ax))^2; Fx=getcf(fx); if isdiscrt(fx)==1 y=[ylow:yhigh]; else y=[ylow:(yhigh-ylow)/L:yhigh]; end P=pval(Fx, sqrt(y))-pval(Fx, -sqrt(y)); if ylow==0 P(1)=pval(Fx, 0); end Fy=[Fx(1,:); y' P']; if iscf(Fy)==0 error('failed') end fy=getpf(Fy); if isdiscrt(fx)==1 y=xvals(fy); p=pvals(fy); y=y(find(p>0)); p=p(find(p>0)); fy=[fy(1,:); y' p']; end