简体   繁体   中英

Matlab symbolic function with normcdf

I have the following function for which I want to find the extrema using matlab.

在此处输入图片说明

That function has to use the "normcdf" function in matlab in order to get the results but when I'm trying to create the symbolic function I get back some errors.

The input I give is the following:

syms z fz t sz
fv = 1000 * ((z * fz * normcd(t,fz,sz)) / (20 * 50 * normcd(t,50,20))) + 1000 * normcdf((20 * 50 * normcd(t,50,20) + z * fz * normcd(t,fz,sz)) / 2000, 50 * normcd(t,50,20), 20) - 10 * z

and the errors I get back are the following:

??? Error using ==> sym.le at 11
Function 'le' is not implemented for MuPAD symbolic objects.

Error in ==> normcdf at 57
sigma(sigma <= 0) = NaN;

Does anyone know how I can get around that? Thanks in advance.

I forgot to mention that I use matlab version R2009a.

It appears to work for me:

>> syms z fz t sz
>> fv = 1000 * ((z * fz * normcdf(t,fz,sz)) / (20 * 50 * normcdf(t,50,20))) + 1000 * normcdf((20 * 50 * normcdf(t,50,20) + z * fz * normcdf(t,fz,sz)) / 2000, 50 * normcdf(t,50,20), 20) - 10 * z

>> subs(fv,{fz,sz,t,z},{1,2,3,4});

ans =

 809.2922

Take a look at the Subs .

I found a way around it. Instead of using normcdf one can use its equivalent equation with erf which then works fine.

normcdf(x,mu,sig) = (1+erf((x-mu)/sig/sqrt(2)))/2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM