MATLAB: How to define a cumulative distribution function with variable in it

cumulative distribution function

Hi everyone, I'm having problem trying to solve for the integral of the cumulative distribution function for my thesis. I want to hold x as variable for F(x) and solve it later to optimize it. The problem is the function normcdf(x,mu,sigma) doesn't allow me to define x as symbol, it require x to be a double value instead. So my question is, is there anyway to define x as "syms x" and then use normcdf(x,mu,sigma)?
With the uniform distribution I write the function straightforward in the program like this:
gamma = 0; n = 150; syms e Q_sc Q_r X Pi_sc Pi_r S_Q S_Q2 x h t; S_Q = Q_sc – int(((e-gamma+n)/(2*n)),e,0,Q_sc – D_r); S_Q2 = Q_r – int(((e-gamma+n)/(2*n)),e,0,Q_r – D_r); Pi_sc = (S_Q*(p-c_m-s+g_r+g_m+(G1*(s_return-l_m-l_r-r)))) + ((s-c_r)*Q_sc) – ((g_r+g_m)*D_r); Diff_Pi_sc = diff(Pi_sc,'Q_sc'); Q_sc = solve(Diff_Pi_sc); Q_sc = vpa(Q_sc);
So instead of writing unifcdf(…), I use ((e-gamma+n)/(2*n)) instead, because I want to keep "e" as variable, I don't want the program to calculate in right away. Is there anyway I can achieve this task using unifcdf function provided by the program?
Thank you very much in advance

Best Answer

f = @(x) normcdf(x,mu,sigma);