-1
$\begingroup$

Could you please provide a full Matlab programme (which can be copied and pasted directly) that can plot the solution to the stochastic differential equation (SDE) $dx(t)=Ax(t)dt+Bx(t)dW(t)$, (where $x(t)$ is plotted as vertical axis, and time t is plotted as horizontal axis), where both A and B are given 2*2 matrices(please give some appropriate numbers to fix matrix A and B for programming), W(t) is Ito type Brownian motion (BM). I am very curious about how to set the BM with Matlab. Must I use any package or tool box to handle this issue? In addition, shall we make any assumption about the setting of BM in Matlab, especially for its variance? Shall we set the variance to a fixed number like 1, or bigger number like 100 or 1000? Thank you very much.

$\endgroup$

closed as off-topic by астон вілла олоф мэллбэрг, Behrouz Maleki, Claude Leibovici, John B, E. Joseph Dec 8 '16 at 18:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about mathematics, within the scope defined in the help center." – астон вілла олоф мэллбэрг, Behrouz Maleki, Claude Leibovici, John B, E. Joseph
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Are A,B constant numbers ? $\endgroup$ – Khosrotash Dec 8 '16 at 10:48
  • $\begingroup$ Yes they are constant matrices that are given. $\endgroup$ – H Hua Dec 8 '16 at 11:12
  • $\begingroup$ It is stochastic field or yuor $t$ is one-dimensional? $\endgroup$ – kolobokish Dec 8 '16 at 11:37
  • $\begingroup$ t is scalar. But x(t) is a vector, for example[x_1(t)', x_2(t)]' $\endgroup$ – H Hua Dec 8 '16 at 11:39
3
$\begingroup$

Every time you rum the program you will see a new figure (note that)

first thing you must do is "discretization"

for example see below:

$$dx_t=a.x_t dt+ b.x_t.dw_t\\ \Delta x_t=a.x_t .\Delta t +b.x_t.\Delta W_t \\ x_{i+1}-x_i=a.x_i.\Delta t_i +b.x_i.\Delta W_{t_i}\\ $$ if partitions are equidistant ... $$\Delta t_t=\Delta t=\frac{T-t_0}{n}\\\Delta W=\sqrt{\Delta t}*randn$$ so you can code this form $$x(i+1)-x(i)=a*x(i)*\Delta t +b*x(i)*\sqrt{\Delta t}*randn\\ $$

%dx(t)=ax(t)dt+bx(t)dW(t)  
%for exaple a=2, b=0.5  
t0=0;        %begin time
T=1;         %terminal time
n=100;       %number of steps
dt=(T-t0)/n  %set delta t
a=2;         %input a
b=0.5;       %input b
dw=zeros(1,n);  
axis=[t0+dt:dt:T];
x=zeros(1,n);
x(1)=2;      %x(1)=x0=2  initial condition

for k=2:n
  dw(k)=sqrt(dt)*randn;  
  x(k)=x(k-1)+a*x(k)*dt +b*x(k-1)*dw(k-1);
end

grid on  
hold on 
plot(axis,x)

enter image description here this is 1st run of program

$\endgroup$
  • $\begingroup$ I am considering a continuous-time case. Do you mean every continuous SDE must be transformed into discrete case? Thanks a lot!!! $\endgroup$ – H Hua Dec 8 '16 at 11:16
  • $\begingroup$ Usually SDE's have not a closed form solution ,but your case has. when you are programing you must duscreet the timing to use "for i=..." $\endgroup$ – Khosrotash Dec 8 '16 at 11:21
  • $\begingroup$ I put an example for 1dimenstion example . hpoe can help you $\endgroup$ – Khosrotash Dec 8 '16 at 11:22
  • $\begingroup$ Please let me try. Thank you very much. If there is any more question, please forgive me to ask. I do appreciate your help! Many thanks! $\endgroup$ – H Hua Dec 8 '16 at 11:26
  • $\begingroup$ I am working for a two dimension SDE ,and programing of it . $\endgroup$ – Khosrotash Dec 8 '16 at 11:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.