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)
Afficher commentaires plus anciens
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
Réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!