Info

This question is closed. Reopen it to edit or answer.

Financial Function Issue, Please help?

1 view (last 30 days)
Mike
Mike on 19 May 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Hey guys,
So I've been reading from a book learning how to use MATLAB with financial and economic applications and the author supplements with a lot of his own written functions to calculate asset prices and other underlying factors. Anyways, almost every time I try to use one of his functions I get the exact same two errors. I'll post a function below and see if you guys can help me out. I think I'm putting the functions in the right directory on my PC because some of the functions work but the other 75% don't. Please help a guy out if you can. I'd really appreciate it. If you could please explain what's wrong in rookie terms I'd appreciate it. I'm a MATLAB newbie, just learning the ropes.
function p=Exchange(V0,U0,sigmaV,sigmaU,rho,T,r)
sigmahat=sqrt(sigmaU^2+sigmaV^2-2*rho*sigmaU*sigmaV);
dl=(log(V0/U0)+0.5*T*sigmahat^2)/(sigmahat*sqrt(T));
d2=dl-sigmahat*sqrt(T);
p=V0*normcdf(dl)-U0*normcdf(d2) ;
end
Error using Exchange
(line 2)
Not enough input
arguments.
Error in run (line 63)
evalin('caller', [script
';']);

Answers (1)

dpb
dpb on 19 May 2014
function p=Exchange(V0,U0,sigmaV,sigmaU,rho,T,r)
...
Error using Exchange (line 2) Not enough input arguments.
Error in run (line 63) evalin('caller', [script ';']);
You didn't supply enough info to see the way you tried to use the function but the first error indicates it was called with fewer than values for the seven arguments it expects/requires.
Where, precisely, the second error was triggered can't say w/o seeing what you actually did. Is there some function run supplied that is supposed to dispatch functions from a menu or somesuch, maybe?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!