Crank-Nicolson finite difference method - Error: Function definitions are not permitted in this context.

1 次查看(过去 30 天)
ive copied the codes for Crank-Nicolson finite difference method, but it wont run and keeps showing this error msg 'Error: Function definitions are not permitted in this context.', any idea to fix this? thx guys :)
*function oPrice = finDiffCN(X,S0,r,sig,Svec,tvec,oType)
|
Error: Function definitions are not permitted in this context.*
ooo and one more thing, if it says - undefined function 'finDiffCN' for input arguments of type 'double'- how to fix it? thx!

回答(1 个)

Titus Edelhofer
Titus Edelhofer 2015-6-16
You need to save the code to a file, then call it ...
Titus

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by