From: Jean-Philip Dumont on
Hi,

I'm trying to use the function fzero but it doesn't work.

More specifically, I have a external function called ZCC that evaluates two options to create a zero cost collar. Basically, the output is the cost of the strategy and all my inputs are fixed except one of them which is a strike price of one of the two options. I'm making this strike price vary in order to have a cost of 0.

Here is the command for my function :

[Cost Price] = ZCC(Kz, Fee, N, r, rf, Vol, St, K, D)

and he is my command to find the Kz that is required in order to have an output Cost equal to zero.

Kz = fzero(@ZCC,K0,Options, Fee, N, r, rf, Vol, St, K, D)
and i obtain this error :

??? Error using ==> erfcore
Input must be real.

Error in ==> normcdf at 68
p = 0.5 * erfc(-z ./ sqrt(2));

Error in ==> ZCC at 62
C = St*exp(-rf*T)*normcdf(d1z)-Kz*exp(-r*T)*normcdf(d2z);

Error in ==> fzero at 369
a = x - dx; fa = FunFcn(a,varargin{:});

Can someone tell me what i'm doing wrong?

Thank you very much!
From: Jean-Philip Dumont on
"Jean-Philip Dumont" <jean-philip.dumont(a)hec.ca> wrote in message <i2uhk8$2s6$1(a)fred.mathworks.com>...
> Hi,
>
> I'm trying to use the function fzero but it doesn't work.
>
> More specifically, I have a external function called ZCC that evaluates two options to create a zero cost collar. Basically, the output is the cost of the strategy and all my inputs are fixed except one of them which is a strike price of one of the two options. I'm making this strike price vary in order to have a cost of 0.
>
> Here is the command for my function :
>
> [Cost Price] = ZCC(Kz, Fee, N, r, rf, Vol, St, K, D)
>
> and he is my command to find the Kz that is required in order to have an output Cost equal to zero.
>
> Kz = fzero(@ZCC,K0,Options, Fee, N, r, rf, Vol, St, K, D)
> and i obtain this error :
>
> ??? Error using ==> erfcore
> Input must be real.
>
> Error in ==> normcdf at 68
> p = 0.5 * erfc(-z ./ sqrt(2));
>
> Error in ==> ZCC at 62
> C = St*exp(-rf*T)*normcdf(d1z)-Kz*exp(-r*T)*normcdf(d2z);
>
> Error in ==> fzero at 369
> a = x - dx; fa = FunFcn(a,varargin{:});
>
> Can someone tell me what i'm doing wrong?
>
> Thank you very much!

SORRY, FORGET IT!

IT WAS A DUMB MISTAKE IN MY FUNCTION.

HAVE A NICE DAY EVERYONE