Mostra commenti meno recenti
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 Commenti
Andrew Newell
il 24 Gen 2012
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
il 24 Gen 2012
Andrew Newell
il 24 Gen 2012
No, I mean something like
dx1/dt = ...
dx2/dt = ...
Sara
il 24 Gen 2012
Andrew Newell
il 24 Gen 2012
What is u? You have it equal to zero except at one point.
Sara
il 24 Gen 2012
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!