索引矩阵乘法用于matlab编码器到C

时间:2016-02-02 16:27:13

标签: c matlab matrix matlab-coder

我想加快我的euler / Ornstein-Uhlenbeck代码,尝试加速for循环,使用matlab编码器将其转换为C.但是,索引似乎有问题,但我看不出有什么问题。非常感谢..

function  [x,t]       = Quick_Euler(N_t,N,A,G,dt) 
   x      = zeros(N,N_t);
   t      = zeros(1,N_t); 
for i = 2 : N_t
   n         = randn([N,1]);   
   x(1:N,i)  = x(1:N,i-1)     + dt^(.5)*G*n + (A*x(1:N,i))*dt;
   t(1,i)    = t(1,i-1)   + dt;      
end  
end

编译器:

>> coder -build Quick_Euler.prj
??? Size mismatch (size [:? x 1] ~= size [:? x :?]).
<br>Mismatched varying and fixed sizes indicate a probable run-time error.
If this diagnostic is incorrect, use indexing to explicitly make the varying size fixed.

0 个答案:

没有答案