【问题标题】:Extract the values for some parameters from stochastic differential equation solution从随机微分方程解中提取一些参数的值
【发布时间】:2016-05-25 13:15:18
【问题描述】:

我在 matlab 中求解随机微分方程。 例如: 考虑随机微分方程

dx=k A(x,t)dt+  B(x,t)dW(t)

其中k是常数,A和B是函数,dW(t)是维纳过程。

我绘制了 [0,20] 中所有 t 的解。我们知道 dW(t) 是随机生成的。我的问题是:我想知道 A(x,t)、B(x,t)、dW(t) 对于特定 t 值和特定子区间(例如 [3,6])的值。我可以在 Matlab 中使用什么命令?

这是我根据 D.Higham 的论文使用的代码:

clear all
close all

t0   = 0;     % start time of simulation
tend = 20;   % end time

m=2^9; %number of steps in each Brownian path

deltat= tend/m; % time increment for each Brownian path
D=0.1; %diffsuion 
R=4;
dt =  R*deltat; 
dW=sqrt( deltat)*randn(2,m);
theta0=pi*rand(1);
phi0=2*pi*rand(1);
P_initial=[ theta0; phi0];

L =  m/ R;
pem=zeros(2,L);
EM_rescale=zeros(2,L);
ptemp=P_initial;

for j=1:L
   Winc = sum(dW(:,[ R*(j-1)+1: R*j]),2);
   theta=ptemp(1);% updating theta
   phi=ptemp(2); % updating phi
   %psi=ptemp(3); % updating psi

   A=[  D.*cot(theta);...
       0];% updating the drift

   B=[sqrt(D)  0 ;...
      0 sqrt(D)./sin(theta) ]; %% updating the diffusion function

   ptemp=ptemp+ dt*A+B*Winc;
   pem(1,j)=ptemp(1);%store theta
   pem(2,j)=ptemp(2);%store phi

   EM_rescale(1,j)=mod(pem(1,j),pi); % re-scale theta
   EM_rescale(2,j)=mod(pem(2,j),2*pi);   % re-scale phi
end

plot([0:dt:tend],[P_initial,EM_rescale],'--*')  

假设我想知道每个特定时间点或任何时间间隔的所有参数(包括随机:布朗)。该怎么做?

【问题讨论】:

    标签: matlab stochastic-process


    【解决方案1】:

    我在这里尽我所能理解你的问题,但我还是有点不清楚。

    将循环改为:

    for ii=1:L
       Winc = sum(dW(:,[ R*(ii-1)+1: R*ii]),2);
    
       theta=ptemp(1);% updating theta
       phi=ptemp(2); % updating phi
    
       A{ii}=[  D.*cot(theta);...
           0];% updating the drift
    
       B{ii}=[sqrt(D)  0 ;...
          0 sqrt(D)./sin(theta) ]; %% updating the diffusion function
    
       ptemp = ptemp + dt*A{ii}+B{ii}*Winc;
       pem(:,ii) = ptemp;
    
       EM_rescale(1,ii) = mod(pem(1,ii),pi); % re-scale theta
       EM_rescale(2,ii) = mod(pem(2,ii),2*pi);   % re-scale phi
    
    end
    

    现在,您可以通过这种方式获取A 和B 的值:

    t = 3;
    t_num = round(m/tend*t);
    
    A{t_num}
    B{t_num}
    ans =
            0.0690031455719538
                             0
    ans =
             0.316227766016838                         0
                             0          0.38420611784333
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-19
      • 1970-01-01
      • 1970-01-01
      • 2016-05-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多