0
votes

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

enter image description here

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.

2

2 Answers

0
votes

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.

0
votes

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