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!