using ode45
古いコメントを表示
Dear all,
I would like to solve the following system of differential equations with input with Matlab. I tried with ODE45. Unfortunately, I always get a very strange behaviour of the solution, almost insensitive to the input. The values of the parameters (taus tauf etc..) are taken from a work where integration of the same equations was succesfull, and are supposed to be meaningful. The input should be an impulse at given time. The solution should look null before the impulse, increasing afterwards, reaching zero again after about 20 sec.
It is probably some stupid mistake but I cannot get it right. Any suggestion?
Thanks in advance, Sara
%%---------------------------------
pnts = 7680;
dt = 0.0039;
x0 = zeros(1,2);
u = zeros(pnts,1);
u(768) = 1;
t = [1 pnts]*dt;
[T, SOL] = ode45(@fx, t, x0,[],u,dt);
%% ----------------------------
function dx = fx(t,x,u,dt)
ui = u(ceil(t/dt));
x = x';
taus = 0.8;
tauf = 0.4;
epsilon = 0.5;
dx(:,1) = epsilon*ui-x(:,1)./taus-(x(:,2)-1)./tauf;
dx(:,2) = x(:,2);
dx = dx';
end
%%---------------------------------------------------------------
6 件のコメント
Andrew Newell
2012 年 1 月 24 日
It might help if you tell us what the equation is that you are trying to solve (in case you're not representing it right).
Sara
2012 年 1 月 24 日
Andrew Newell
2012 年 1 月 24 日
No, I mean something like
dx1/dt = ...
dx2/dt = ...
Sara
2012 年 1 月 24 日
Andrew Newell
2012 年 1 月 24 日
What is u? You have it equal to zero except at one point.
Sara
2012 年 1 月 24 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!