[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error: can't perform indexing operations for <unknown type> type
From: |
c. |
Subject: |
Re: error: can't perform indexing operations for <unknown type> type |
Date: |
Tue, 13 Dec 2011 06:18:12 +0100 |
On 13 Dec 2011, at 04:52, Taza wrote:
> the following script equation for the model is in matlab,
> % matlab script to generate assetpaths
> S = S0*[ones(1,nsims); ...
> cumprod(exp(nu*dt+sig*sqrt(dt)*randn(steps,nsims)),1)];
> am trying to apply the same concept in octave but it seems that iam having
> a problem with my cumulative product use in octave
why didn't you use exactly the same code in Octave?
that seems to work for me:
S0 = 50;
mu = 0.04;
sig = .1;
dt = 1/365;
steps = 50;
nsims = 15;
nu = mu - (sig^2/2);
S = S0*[ones(1,nsims); cumprod(exp(nu*dt+sig*sqrt(dt)*randn(steps,nsims)),1)];
size(S)
ans =
51 15
you'll have to provide more info if you want someone to understand what's going
wrong for you.
Please don't send your code as images as images as it make it impossible to cut
and paste to test.
c.