• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

simulate a nonlinear drift

Joined
11/3/08
Messages
18
Points
11
i have a diffusion process with nonlinear drift on the form:
(\mu(dt) = (\alpha1+\alpha2*x+\alpha3*(x2)+\alpha4/x) dt)

i have simulate the drift on matlab but the graph i get is empty .
this is the program
Code:
clf
load TRB.txt % Load Data

X = TRB(1:T,1)/100;
T = rows(TRB);
N = 2087; Delta = 1/T;
% simulation du processus de CIR-SR
alpha1 = -4.0224; alpha2 = 0.08893; alpha3 = -0.0608; alpha4 = 7.1945;

for X = 1:T

mu = (alpha1 +alpha2*X + alpha3*(X^2) + alpha4/X)* Delta;
plot(X,mu);

end
can you help me and tell me where is the problem.
 
i have a diffusion process with nonlinear drift on the form:
(\mu(dt) = (\alpha1+\alpha2*x+\alpha3*(x2)+\alpha4/x) dt)

i have simulate the drift on matlab but the graph i get is empty .
this is the program
Code:
clf
load TRB.txt % Load Data
 
X = TRB(1:T,1)/100;
T = rows(TRB);
N = 2087; Delta = 1/T;
% simulation du processus de CIR-SR
alpha1 = -4.0224; alpha2 = 0.08893; alpha3 = -0.0608; alpha4 = 7.1945;
 
for i = 1:T
 
mu = (alpha1 +alpha2*X(i) + alpha3*(X(i)^2) + alpha4/X(i))* Delta;
plot(X(i),mu);
hold on;
 
end
 
hold off;
can you help me and tell me where is the problem.

Use the above code.
See if it works or not.Also i think this code can be vectorized which will be faster.
 
I think your code should be as follow.
Code:
clf
load TRB.txt % Load Data
 
X = TRB(1:T,1)/100;
T = rows(TRB);
N = 2087; Delta = 1/T;
% simulation du processus de CIR-SR
alpha1 = -4.0224; alpha2 = 0.08893; alpha3 = -0.0608; alpha4 = 7.1945;
 
for i = 1:T
 
mu = (alpha1 +alpha2*X(i) + alpha3*(X(i)^2) + alpha4/X(i))* Delta;
 
end
plot(X,mu);
 
Back
Top