SERVING THE QUANTITATIVE FINANCE COMMUNITY

Lapsilago
Topic Author
Posts: 259
Joined: October 15th, 2004, 7:36 am
Location: Germany

### Matlab Code - Financial Modelling

Hi all,We have released a book on Financial Modelling. The code is freely available athttp://www.mathworks.de/matlabcentral/fileexch ... 246981This could serve as a starting point for a project on Matlab MathFinance library. Anyone who is interested is very welcome not only to comment on the code, share extensions, debugging and developing new functionality. Anyone interested in joining can drop me a PM.Best, Lapsi

Cuchulainn
Posts: 61103
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Matlab Code - Financial Modelling

Congratulations! I received a copy yesterday. Do you intend any C++/C# or other language interop?
Last edited by Cuchulainn on October 23rd, 2012, 10:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget

Lapsilago
Topic Author
Posts: 259
Joined: October 15th, 2004, 7:36 am
Location: Germany

### Matlab Code - Financial Modelling

There is nothing really planned up to now. But maybe a good point for this qf project.I would be happy to test corresponding code against the Matlab stuff! Might be worth to go that way!Best, Lapsi

Cuchulainn
Posts: 61103
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Matlab Code - Financial Modelling

In the book (page 290) the authors mention the Predictor Corrector method for 1 factor SDE (btw I suppose alpha and beta are in range [0,1]?)In general, we can choose:1. Standard drift2. Corrected drift3. Averaging using trapezoidal [n, n+1] (2 function calls per step)4. Averaging using midpoint [n,n+1] (1 function call per step)JK/DW use options 1 + 3. In MC1 each of the 4 options is supported.From experiments options 2 + 4 give best results and better than 1 + 3. A deeper analysis of 4 options using Matlab and C++ is a good test. E.g. 1+4 in Matlab. BTW no one seems to use 4 altho' you see it all over the place in numerical analysis.
Last edited by Cuchulainn on October 24th, 2012, 10:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget

Cuchulainn
Posts: 61103
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Matlab Code - Financial Modelling

The strong PC are described here.The main one is eq. 2.8 where they use trapezoidal. We can also use midpoint averaging.
Last edited by Cuchulainn on October 24th, 2012, 10:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget

pimpel
Posts: 363
Joined: May 12th, 2006, 5:26 pm
Location: Warsaw

### Matlab Code - Financial Modelling

Lapsi,In function modSQP on line 128 you have a call of quadOPT function started as:[sol,lambda,~,qiter] = ...In my version of Matlab ~ is used only as logical operator and that produces an error. Is it a bug, or just some difference in Matlab parameterization?

Lapsilago
Topic Author
Posts: 259
Joined: October 15th, 2004, 7:36 am
Location: Germany

### Matlab Code - Financial Modelling

Hi,we have used Matlab Verison R 2012a and I think "~" is there used as an optional output. Actually, Daniel W. did the SQP stuff. He will be back in December and then, he can suggest a solution of your problem.Best, Lapsi

pimpel
Posts: 363
Joined: May 12th, 2006, 5:26 pm
Location: Warsaw

### Matlab Code - Financial Modelling

Lapsi,Is it working on you Matlab instalation? I have an older version, where it was used as a logical operator only meaning NOT. I searched the docs to 2012b version on mathworks.com, but I can not find other meaning than that of logical operator.Best, Pimpel

Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

### Matlab Code - Financial Modelling

Last edited by Polter on November 18th, 2012, 11:00 pm, edited 1 time in total.

Lapsilago
Topic Author
Posts: 259
Joined: October 15th, 2004, 7:36 am
Location: Germany

### Matlab Code - Financial Modelling

Thanks Polter!Might be a good idea to move to a higher version then. But if you cannot do this for any reason I could ask Daniel W. who actually implemented SQP for a version without "~" when he is back in the office in Dec.Best, Lapsi

pimpel
Posts: 363
Joined: May 12th, 2006, 5:26 pm
Location: Warsaw

### Matlab Code - Financial Modelling

Thank you all for the support, I think it is high time for moving to higher version, mine is already pretty old...Regards,Pimpel

Salain
Posts: 10
Joined: April 22nd, 2010, 7:05 pm

### Matlab Code - Financial Modelling

No need to change Matlab versions for that, just replace the tilde with an unused variable, such as "tildeTrash". If you don't want the overhead this causes then you can make a version of the called function without that returned parameter.

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...

 JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...

GZIP: On