迭代时所调用的M文件里的常参数不会更新问题?。
Afficher commentaires plus anciens
我在编写一个循环程序时,需要调用一个M文件来求解微分方程组,要求每次迭代时,微分方程组的系数矩阵都要变化,这如何做到啊?或者是否有别的解决方法?求各位大神解决!
M文件(矩阵A,B不变,而矩阵或向量K0需要每次更新)
function dx=adpsimple1(t,x)
A=[1 0;0 0.5];B=[0.3;0.2];
(A-B*K0)*x;
end
>> K0=[10 10];[t1,z]=ode45('adpsimple1',t0,x0)
Undefined function or variable 'K0'.
Error in adpsimple1 (line 3)
(A-B*K0)*x;
Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 编程 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!