hi , I have system of coupled 1d differential equations , I write a code to solve them , the code run but it gives wrong results, can anyone told me what the problem in the code , this will help me a lot , thanks in advance

1 vue (au cours des 30 derniers jours)
a system of N coupled differential equations dp/dt=-i*cos(c*t)*mat*p-i*p*w
p is vector p=[p1;p2;p3.....;pN];
mat is matrix (NXN) of constant numbers
w is vector of constant numbers w=[w1;w2;w3.....wN]
c is constant number
the code
function dp = myode1(t,p,mat,energy,c)
dp = (-i)*cos(c*t)*(mat*p)+(-i)*energy.*p;
end
[t,p] = ode45(@(t,p)myode1(t,p,mat,energy,c),[0 tf],initial_cond);
  2 commentaires
Torsten
Torsten le 16 Jan 2018
How do you know the results are wrong ?
Best wishes
Torsten.
fatema hamodi
fatema hamodi le 16 Jan 2018
I compare it to the analytical solution and the numerical one is totally different

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by