MATLAB: Substituting an expression not giving intended result

subssymbolicSymbolic Math Toolbox

I'm trying to simplify the following expression using the subs function. In the code below, I was expecting Asubs = 3*Phi. Any ideas on what might be wrong in my code?
clear all;
clc;
syms phi(c,cbar,sigma) Phi(c,cbar,sigma) A(csol,cbar,sigma)
assumeAlso(sigma,'real')
assumeAlso(sigma>0)
phi(c,cbar,sigma)= (1/sqrt(2*sym(pi)*sigma^2))*exp(-(c-cbar)^2/(2*sigma^2))
A(csol,cbar,sigma)=3*int(phi(c,cbar,sigma),c,-inf,csol)
Phi(csol,cbar,sigma) = 1/2 + 1/2*erf(sqrt(2)*(csol-cbar)/(2*sigma))
%Phi(x,sigma) = 1/2 + 1/2*erf(sqrt(2)*(x)/(2*sigma))
Asubs = subs(A,Phi)

Best Answer

Since ‘Phi’ does not appear as such specifically in ‘A’, the substitution will fail.
Perhaps this is closer to what you want:
As = simplify(A/Phi)
prodcing:
As(csol, cbar, sigma) =
3